The bank who you have the mortgage with may have their own terms and conditions and state when you get foreclosed on after so many missed payments.
However the standard procedure for most banks who you take a mortgage out with states that you can have no more than 3 missed mortgage payments before a foreclosure process begins.
During the foreclosure process you can usually stop the foreclosure by paying the back missed mortgage payments.
If you're having trouble making the mortgage payments speak with the bank and let them know and maybe you can even refinance the mortgage and have a lower payment.
For example if you have a 15 year mortgage then your monthly mortgage payment will usually be higher but if you refinance to a 30 year mortgage then your payments can be lower however you'll pay more in interest over the life of 30 year mortgage than you would on a 15 year mortgage.
But if the 30 year mortgage when refinanced helps you stay in your home by making the mortgage payments more easy to manage then it can be worth it.