There are two kinds of foreclosures out there - Judicial and non-Judicial. With Judicial foreclosures, the Sheriff actually does the sale (after it's gone through the court process), and the buyer gets title to the property right then (previous owner actually does have a Right Of Redemption for 180 days - but the odds are slim that they could come up with the money). Unless the new owner wants to keep renting to you, you will probably need to move out right away.
The other type of foreclosures is non-Judicial. It looks pretty much the same, except it's a "trustee" that sells the property on the courthouse steps instead of the Sheriff. In this case, the buyer doesn't have legal right to the property for 10 days following the sale. It's still up to the new owner as to whether or not they want to rent the property to you, but they can't kick you out until that 10 day window is up.
Either way - you probably should plan to move soon... Good luck!!