It really depends on the landlord in question and the treasons for the foreclosure. I find that some landlords are forgiving because they understand the times and especially if you can prove you are on the mend.
You still have a signed legal document that states that you have the legal right to live in your apartment as long as you continue to pay your rent and the landlord must recipricate. No matter who the landlord is.
You are protected by the lease to live there for the entire term of the lease. If you do decide to leave prior the the term, you can find yourself in a legal battle for not living up to your lease. And if the bank does take over, which may not happen, the bank will have extremely good resources to recover the lost rent dollars.... more
I'm assuming you signed a contract for a bank owned property. Bank owned properties are sold as is and no disclosure can be made by the bank [in this case the bank is the seller] because they have never occupied the property nor have they ever even been to the property. But in any event, if you signed a contract to purchase, did you read and were you explained what you were signing? Did you hire an attorney to represent you during the attorney review? If so, did your attorney review and explain the contract to you? Typically there is a backout clause for inspection issues although banks ususally never repair any issues that arise during inspection as its usually listed and sold in as is condition but again your attorney should have explained this to you. If haven't already, you need to retain the services of a real estate attorney.