Until the time the foreclosure is actually concluded by means of a foreclosure sale, your landlord is still the owner of the property, and technically still has the right to evict you if you don't pay. Whether he will actually try to do that depends on all the circumstances. There are attorneys who can defend you against such an attempt. It is also possible that your landlord will defend against the foreclosure, or will work something out to avoid a foreclosure sale.
You should start out by speaking to your landlord to ascertain his plans. if that does not cause you to feel more comfortable with the situation, you should consult a landlort-tenant attorney in your area.
The National Association of Consumer Advocates (NACA) is a non-profit consumer advocacy organization. NACA maintains a web site at www.naca.net where it lists geographically consumer law attorneys all over the US. If you don't already have an attorney, please look there for someone in your area who specializes in landllord-tenant law to review the details with you and advise you.
You are not obligated to make any mortage payments but you are still obligated to pay your landlord, whoever it is, rent to stay compliant with your oblgations. if your landlord loses the property, you will need to make new arrangements with the new owner. That owner may allow you to stay as a tenant. If not, that owner will have to comply with your state's laws to remove you as a tenant. You will need to seek legal advice from an attorney in your state if legal action is necessary.