Homeowners - The end is near
Your house was foreclosed and sold at auction. There's a new owner now and it's not you. It's a bank. At some point what will happen is that you will get a Notice of Possession giving you three days to vacate. Then the bank will file an unlawful detainer to regain possession of the house. Frankly, there's not a lot of defenses at that point. A lawyer can try to negotiate you more time or poke holes in the complaint if possible, but it's time to look at moving on.
Tenants get 90 days notice
If you're a tenant on a month to month and your landlord has been foreclosed on, the new owner-bank has to give you 90 days notice before they can start eviction proceedings - 60 days under Civil Code 1161a and another 30 days under a recent federal law. Those three months are intended to give you a decent amount of time to find another place, but you might do as well to consider a cash-for-keys offer.
Leases are binding
If you're a tenant with a lease, the new owner can't kick you out until the lease expires. That's also part of a new federal law, which supercedes existing law under which a lease is cut off after foreclosure. Again, you may get a buyout of the lease, which may be to your advantage if finding a new place is not too difficult.