Stopping a divorce isn't so much a legal question as it is one of saving your marriage. Legally, if your spouse is intent on getting a divorce, there's usually nothing you can do to prevent it. The best you can do is buy yourself some time to try to change his mind.
Make Sure Time is On Your Side
In some states, uncontested divorces can be over relatively quickly. But an uncontested divorce requires that you and your spouse reach a marital settlement agreement, so if you don't negotiate one, this will eventually force a trial. Trials take much longer, and this may give you time to open a dialogue with your spouse about what you can do to avoid a divorce. The downside is that if your case does go to trial because you won't agree to a settlement, you risk losing things that your spouse might have agreed to give you.
Contest Your Spouse's Grounds
If your spouse files for divorce on fault grounds and you contest them, he must prove his grounds at trial. If he fails to do so, the court will typically dismiss his divorce action. This won't make him happy, however, and he can refile for divorce using no-fault grounds instead. In this case, he typically would not have to prove his grounds to the judge. At best, if you disagree that you and your spouse have irreconcilable differences, the judge might order you to attend counseling, but he can't order your spouse to stay married to you. Ultimately, he will still obtain the divorce.
If You're Successful
If you can convince your spouse to try to mend your marriage, make sure he files a motion of dismissal with the court to terminate the divorce proceedings. In many states, such as Washington, this is the only way the divorce can be officially stopped after one party files. If he doesn't do this, he might decide to proceed with the divorce without your involvement. In this case, your spouse can request a divorce by default if you don't respond to the divorce petition -- and the court will likely award him everything he requested in his petition.