It is increasingly common for couples to sign a legal contract called a "pre-nuptual agreement" before getting married. These agreements concern the division of money, assets, and debts in the event of a divorce or legal separation. They can also address inheritance rights of, say, a child of one spouse from an earlier marriage.
Going into more detail, elements of a pre-nuptual agreement might include establishing by mutual agreement: who would pay spousal support, how much, and for how long should the marriage be dissolved; what portion of real estate or equity in real estate is owned by each party; which property is marital property and which is the personal property of each spouse; who inherits which property should one spouse die; who owes what portion of credit card debts, the mortgage, or other loans; and even things like who keeps the family pet in the event of a divorce.
Pre-nuptual agreements become a legal basis of great importance when a divorce occurs. It determines many issues that would otherwise be determined by state law alone, be hashed out by a judge, or would have to be worked out during the divorce process between the two spouses.