Depends on the situation. Couple of questions... .
1 - Did you finance the home jointly?
2 - Can you afford the home?
3 - Has the foreclosure process already started?
4 - Do you have possession of the house?
If she's still living there, then stopping the foreclosure will likely enable her to drag things out even more. If she is there and hasn't been paying, have you gone to court to get possession back?
I know a foreclosure does impact your credit rating and hers too if she was on the mortgage. If the house is foreclosed and sells for less than the loan amount, are you stuck paying the difference? But sometimes it is safer to take the foreclosure drubbing in a high conflict divorce.
There is no single simple answer.