Don't panic. I was in this situation a year ago and everything worked out great. If you play your cards right you are about to save a boatload of money.
First, if you can locate your current landlord, find him and get him to sign a new lease for however long you wan't to stay in the property. Because of new tenant protection laws the lease will be honored. I signed a new lease the day before the foreclosure and was able to stay 18 months after the foreclosure.
If you plan to buy a house in 18 months or so make the landlord a cash offer for the washer, dryer, fridge, stove ext. Right before foreclosure he will be very receptive to a little extra cash especially since he will be losing those items anyways. I bet you can get them for $50 each. Just make sure you right up and keep the contract.
Keep paying your rent and sit back and wait for the foreclosure notice. Once this happens the bank (most likely Fannie or Freddie) will send contact information for an agent to discuss moving out. Show them the lease you have and tell them you want to stay. They will make you a good offer to leave (2 months rent + lost security deposit). If you decline to leave, you can talk them into lowering the rent and staying through the end of your lease (thatâ€™s what I did - shoot for 15% lower rent).
If you really want to squeeze all you can out of it, delay contacting the agent they assign to sign a new lease with you. You could push it until you get an eviction notice but thatâ€™s playing with fire. Regardless, you won't be paying any rent from the date of the foreclosure until you sign a new lease with them.