The length of time you have to pay your mortgage before foreclosure depends on the bank and what is spelled out in the mortgage contract.
For most mortgages and banks you usually can miss 3 to 4 mortgage payments before the bank starts the foreclosure process on your home.
If you're having trouble paying the mortgage contact the bank to see if they can work something out with you on the mortgage.
If you do miss the mortgage payments and want to stop the foreclosure you'll need to pay off the missed mortgage payments in full plus any late fees before the foreclosure can be stopped.
The foreclosure process can take a few months to 6 months depending on how backlogged the courts are because they'll usually have police show up at your door to remove you from the home.
No they won't arrest you but the police will serve you papers stating you have a certain amount of time to vacate the home and premises.