A marriage is thought of by the courts as a legally binding contract. That's not nearly as romantic as the general perception of marriage, but that is how the legal system looks at the process to help determine the rights of both parties.
This contract can be broken through a divorce. This is why you must go through the proper legal process to dissolve the marriage, to legally undo that contract. You cannot simply make this decision alone, even if you and your spouse agree.
However, a marriage contract may be void in certain circumstances. For example, if the two people getting married are too closely related, it is automatically void. The same is true if either person had already been legally married, hadn't gotten a divorce, and was still married at the time of the second ceremony.
This can happen in some cases with estranged spouses. If the two haven't seen each other in a long time, one party may decide to remarry, but he or she can run into issues if the right steps aren't taken to break the first contract in advance.
The marriage contract can also be void if one party was unfit to make a decision about entering into the marriage. The person may not have understood what was happening because of mental defects or other such issues.
Finally, the contract can be voided if one of the parties is too young. Typically, people need to be at least 18 years old to get married. They can sometimes get married at a younger age with parental consent. If they do so without consent, though, the marriage can be voided without an official divorce.
In many ways, getting married is just like signing a business contract. Be sure you know what makes the union legal and what has to be done to break it off.
Source: Maryland Department of Human Resources, "Legal Rights in Marriage & Divorce in Maryland," accessed Nov. 11, 2016