Like sj209 said, it depends. Based on the course of action that you take (if it's your property), you could be forced out within a month or two, or you might be able to reinstate and/or modify your loan and stay.
If you don't qualify, a short sale might be your best option. It circumvents a foreclosure, so you do not have that stain on your credit report, and it releases you from the loan. Please note, however, that if the property has already gone to trustee sale, then it's too late to make a decision, as the property is no longer in your hands.
Please review the reference below if you would like to learn more, and good luck!