Under federal law, you have a minimum of 90 days, or until your lease is up. If your landlord would give you a new lease prior to the sale, this would probably allow you to stay 90 days past. Your landlord should make sure that the bank has a right to foreclose, though. So many times they don't.
Eviction is a different process from foreclosure. They would notify you.
[In accordance with the community guidelines of Avvo, this is not "legal advice", nor does it form an attorney-client relationship.]