Do Mormons believe that marriage is eternal?
Not automatically, but Latter-Day Saints do believe that marriage, and the family unit that it forms the foundation of, can and should be a sacred, eternal covenant that lasts "for time and all eternity" rather than simply "till death do you part." Like other things of this life that touch on eternity, an eternal marriage has to be set up under Priesthood authority. This is done in a holy temple, in a ceremony known as a sealing, where the marriage is "sealed" upon them under the same authority that was given to Peter in the New Testament, that what he should bind on earth would be bound in heaven.
This can be done as part of a wedding ceremony, or at a later point if the couple was already married before coming to the temple. In the latter case, it is also possible to bring any children of theirs into the same covenant, to be sealed to their parents as an eternal family. (This is not necessary for children born after the parents are sealed in marriage; they are considered "born under the covenant".)
We believe marriage can be eternal. But you need to meet the standards of that honor. D&C 132:7 teaches:
And verily I say unto you, that the conditions of this law are these: All covenants, contracts, bonds, obligations, oaths, vows, performances, connections, associations, or expectations, that are not made and entered into and sealed by the Holy Spirit of promise, of him who is anointed, both as well for time and for all eternity, and that too most holy, by revelation and commandment through the medium of mine anointed, whom I have appointed on the earth to hold this power (and I have appointed unto my servant Joseph to hold this power in the last days, and there is never but one on the earth at a time on whom this power and the keys of this priesthood are conferred), are of no efficacy, virtue, or force in and after the resurrection from the dead; for all contracts that are not made unto this end have an end when men are dead.
The emphasis is mine, and it is for the purpose of making a complex discussion simple.
For a marriage1 to be eternal:
The marriage must be made and entered into by the Holy Spirit of Promise. This means through the use of a specific priesthood authority — the sealing authority. (see D&C 124:124)
The marriage must be sealed by the Holy Spirit of Promise, a specific function of the Holy Ghost that is required for entrance into the Celestial Kingdom (see D&C 76:50-70 (53)). This is an issue of personal responsibility. The LDS Church believes the Lord gave us commandments and instructed us in behavior to set a standard for conduct, education, and preparation for heavenly opportunities (see D&C 20:29-30). Meeting these standards is not enough to justify salvation (see Luke 17:10 and Mosiah 2:21), we must also depend on the atoning grace of Jesus Christ. However, we also believe that the atoning grace of Jesus Christ alone is not enough to justify salvation, that judgement is a very real event and that standards exist for the sake of that judgement (see Acts 17:30-31 and John 12:48-49). Thus, our part is to meet His standards for judgement and His part is to extend his atoning grace. Together salvation is attained. (This is a VERY SIMPLE introduction to a complicated subject, which is well beyond the scope of this question to discuss.)
The person officiating over the marriage must have been annointed to do so. This is important. The Aaronic priesthood cannot seal a marriage. The Melchezidek Priesthood generally cannot seal a marriage. Only someone specifically called and given the sealing power can do so. (for example Helaman 10:6-7 and D&C 81:2)
Finally, the marriage must specifically announce that the sealing is for time and all eternity. In other words, if a man annointed to be a sealer also serves as a bishop (who has the authority to perform civil marriages), then the fact that he is a sealer does NOT mean that the performance of a civil marriage constitutes an eternal sealing and those being married should not conclude otherwise. (You'd think this was obvious, but every church's history can point to people whose misunderstanding of a loosely worded or incompletely expressed idea (such as happens when you read a single verse out of context) caused problems. Such people can create schisms, so the extra clarity is appreciated.)
And if you don't meet all four of those requirements, your marriage ends when the first spouse dies.
1 The word "marriage" to a Mormon means a civil marriage or a marriage made under the authority of another religion. It is a temporary union that ends when the first spouse dies. Mormons who qualify to enter our temples may participate in a "sealing," which is a potentially permanent union for time and all eternity. They are called a "sealing" to (a) distinguish it from a mere "marriage" and (b) to honor the priesthood key (the sealing authority) upon which it depends. However, in an effort to avoid as much confusion as possible, I'll use the much more recognizable word "marriage" throughout my answer.