Your post is a little confusing in that you don’t state if you are already in foreclosure or are close to entering foreclosure. This makes it difficult to give specific steps that may help.
Generally, to stop a foreclosure you must pay a certain amount by a certain date. The amount and date are found in the foreclosure notice. If you have not paid your mortgage for a length of time, the amount to be paid will be high.
If you are able to pay this amount by the due date stated, a release of foreclosure will be filed showing you are out from under the foreclosure.
Having been a lender who has helped people out of foreclosure (hard to believe a lender would do this, right?), I know there are companies who will look at your situation and may, emphasis on may, give you a new loan.
Without knowing any more about your situation that is the best I can say at the moment. By the way, I am no longer a lender and do not recommend any companies. You have to do your own research in this regard.
Good luck and I hope you resolve your situation especially if you want to keep your home.