Two IRS publications address the issue of tax on sale of the marital home:

IRS Publication 504: Divorced or Separated Individuals

The following is excerpted from Publication 504:

Sale of Jointly-Owned Property
If you sell property that you and your spouse own jointly, you must report your share of the recognized gain or loss on your income tax return for the year of the sale. Your share of the gain or loss is determined by your state law governing ownership of property. For information on reporting gain or loss, see Publication 544.
          Sale of home.   If you sold your main home, you may be able to exclude up to $250,000 (up to $500,000 if you and your spouse file a joint return) of gain on the sale. For more information, see Publication 523, Selling Your Home (below).

Costs of Getting a Divorce
You cannot deduct legal fees and court costs for getting a divorce. But you may be able to deduct legal fees paid for tax advice in connection with a divorce and legal fees to get alimony. In addition, you may be able to deduct fees you pay to appraisers, actuaries, and accountants for services in determining your correct tax or in helping to get alimony.

IRS Publication 523: Selling Your Home

Note that even if the house is sold years after the divorce, you still receive the tax benefit, provided that the sale was included “incident to divorce.”

The following is excerpted from Publication 523:

Transfer to spouse.   If you transfer your home to your spouse, or to your former spouse incident to your divorce, you generally have no gain or loss (unless the Exception, discussed next, applies). This is true even if you receive cash or other consideration for the home. Therefore, the rules explained in this publication do not apply.

If you owned your home jointly with your spouse and transfer your interest in the home to your spouse, or to your former spouse incident to your divorce, the same rule applies. You have no gain or loss.

Exception.   These transfer rules do not apply if your spouse or former spouse is a nonresident alien. In that case, you generally will have a gain or loss.

Divorce Tip: If you are uncertain of the tax liability, talk to your lawyer or a tax professional.

SOURCE: DivorceNet