1. Eviction. Once the lender has set a foreclosure date, call them and let them know you plan to be out of the house by then. Get instructions for where to send the keys, and do this so that they receive them before that date. Lastly, remove all items from the house... do not leave anything behind. Presence of personal items can trigger legal eviction proceedings even if you have vacated the property.
This is important because even a dismissed eviction action (unlawful detainer) will show up on rental check reports for 7 years, and seriously imperil your ability to rent an apartment. Apartment management can get over bankruptcy and foreclosure if you have a paycheck, but even a dismissed eviction action will cause many managers to automatically reject you.
2. Foreclosure deficiency. Your lender will likely not be able to sell the house for what you owe. The difference is what you will still owe even after foreclosure, unless your state does not allow it. If you avoid foreclosure through deed-in-lieu or short sale, enlist some legal help to get the lender to agree to forgo or waive any foreclosure deficiency. If it goes all the way to foreclosure, you may be on the hook for this amount, even if the lender does not come after you right away. Call the lender after the foreclosure date and find out the amount the house sold for and the loan amount, so you know the amount of the deficiency. If it is beyond your ability to pay, you will need to file for bankruptcy to protect yourself.
This is a grim topic, but if you are in this predicament, dealing with these two issues properly will help you make the best out of a bad situation.