Good question, subject to terms and conditions you agreed to, you are under contractual obligation to pay the landlord the rent regardless if they pay the mortgage. It's unfortunate but you have a legal obligation to pay. If you are comfortable asking, you can try to renegotiate the terms...make sure you get it in writing too.
If and when the house goes into foreclosure a listing agent on behalf of the bank and/or seller (investor) will typically approach the renter to come to terms with moving out. SOMETIMES, and I want to make sure you understand that SOMETIMES you may be compensated for the inconvenience of having to move out. It is referred to as "cash for keys". Best regards.