If the mortgage is not paid, the house will eventually be offered for sale at an auction, which will be open to the general public. You will not be able to get "first shot", even though you are currently a tenant, but you will be able to bid on the house, along with anyone else interested in doing so.
Once the house is sold, the new owner must honor your lease, unless he will be moving into the home, in which case, you have to be allowed at least 90 days to find a new place. The 90 days also applies if you have no lease when the house is sold.
The experts at JustAnswer.com can only provide legal information, not legal representation.
If you have reason to believe your landlord no longer has your security deposit available, it does make sense to apply that deposit to the last few months you are there before the house is sold.
DISCLAIMER: Answers from Experts on JustAnswer are not substitutes for the advice of an attorney. JustAnswer is a public forum and questions and responses are not private or confidential or protected by the attorney-client privilege. The Expert above is not your attorney, and the response above is not legal advice. You should not read this response to propose specific action or address specific circumstances, but only to give you a sense of general principles of law that might affect the situation you describe. Application of these general principles to particular circumstances must be done by a lawyer who has spoken with you in confidence, learned all relevant information, and explored various options. Before acting on these general principles, you should hire a lawyer licensed to practice law in the jurisdiction to which your question pertains.
The responses above are from individual Experts, not JustAnswer. The site and services are provided “as is”. To view the verified credential of an Expert, click on the “Verified” symbol in the Expert’s profile. This site is not for emergency questions which should be directed immediately by telephone or in-person to qualified professionals. Please carefully read the Terms of Service (last updated February 8, 2012).