Usually, no. Unless you have a written lease agreement that has not expired, a landlord may evict a tenant for no reason ("no cause") so long as the proper advance notice is given.
If you are a tenant and your landlord is being foreclosed on, use this form to enter an appearance in the foreclosure case. Once this form is filed with the court you should get notices about the foreclosure case.