Just like it takes two to tango, it takes two to have a marriage. If one person wants out of a marriage, the other one can't really prevent a divorce. Both parties have to be committed to keep a marriage together.
It often happens that one spouse decides to seek a divorce before the other spouse is even aware of that possibility. People frequently think through their marital problems and come to the conclusion or realization that a divorce is what they want, all without involving their spouse in the deliberations.
The result is that one party is often surprised and unprepared for a divorce. That party also often wants to try to preserve the marriage.
If you find yourself in that position, here are some things to think about.
1. Get some counseling with a good professional counselor. Look within yourself and your marriage. Do you really not want a divorce? Is it possible, after the shock wears off, that you also might be better off ending the marriage? Have you overlooked the signs of discontent or problems in the relationship? How committed is your spouse to the divorce? Try to review the situation as objectively as you can, but depend on help from a good counselor. This is not something you should try to deal with on your own.
2. Is your marriage past the point of no return? If you want to save the marriage, don't burn the bridges by your reaction to your spouse. You need to figure out if there's still something valuable to salvage and build upon. If you spouse is having an affair or living with someone, the odds are that you can't resurrect the marriage. Be realistic. If your spouse has hurt you financially, emotionally or physically, it may be best to cut the ties.
3. If you want to preserve the marriage, here are some ideas.
Recognize that divorce is inevitable, if either one of you wants it. You may be able to slow it down, but you really can't stop it, if your spouse is persistent.
Don't burn your bridges. Be nice to your spouse. Being mean or destructive is not going to win back your spouse. You may have to work on the divorce while you are trying to get your spouse to reconsider.
Be fair to yourself. Don't rollover in a settlement. Giving your spouse everything, or most things, will not win him or her back. That strategy just doesn't work. Don't give away the farm. I have seen that happen and then the other spouse still goes through with the divorce.
Make it clear that the door is open and you're willing to work on issues, if your spouse is. It must be a two-way street. Your spouse has grievances against you, at least some of which are legitimate, and you will also have grievances against your spouse, at least some of which are legitimate. If your spouse takes the position that you must unilaterally make all the changes, that's not going to work and you won't like the outcome.
Reconciling is a huge up-hill battle. Don't expect an easy or smooth trip. Be prepared to invest a lot of emotion and effort and even then, it may not work.
If your spouse says it's all your fault.
If your spouse has acted dishonestly. Or,
If your spouse demands a deal very unfavorable to you, before he/she will talk with you.
If any of those situations occur, go see a divorce lawyer.