If you have a valid lease, the bank must respect that to the end of the lease. If you don't have a lease they have to give you 90 days.
After the foreclosure sale, you will be contacted by the broker assigned to market the property, the bank or both regarding your status. You need to have a copy of your lease available, and if you will begin paying your rent to the bank through their property management company.
Given that you have nearly a year left, the bank will be willing to negotiate with you a payment (Relocation Assistance or Cash for Keys). Even if it were only the 90 days, they would be willing to negotiate. Their desire is to get control of the property in as short a period of time (30 days) and in as good condition as possible, so the spread between your lease term and 30 days gives you a good deal of leverage.
I am reluctant to give more specific insight in such a public forum, but if you would like to contact me at firstname.lastname@example.org I would be happy to have a conversation with you about what to expect.