Sexuality has a prominent role within the theology of Mormonism, including that of The Church of Jesus Christ of Latter-day Saints (LDS Church). The church teaches that gender is defined in the premortal existence, and that part of the purpose of mortal life is for men and women to be sealed together, forming bonds that allow them to progress eternally together in the afterlife. It also teaches that sexual relations within the framework of opposite-sex marriage is healthy, necessary, and ordained of God. In contrast with some orthodox Christian movements, sexuality in Mormon theology is neither a product of original sin nor a "necessary evil". LDS Church doctrine bars sexual behavior outside of heterosexual marriage, and sexual transgressions are considered second only to murder in seriousness.
The LDS Church teaches its members to obey what it calls the law of chastity, which is a code of morality and modesty. Under this code, all members are taught to be "morally clean in their thoughts, words, and actions" and to abstain from pornography. Violations of this code include "adultery, being without natural affection, lustfulness, infidelity, incontinence, filthy communications, impurity, inordinate affection, fornication. They included all sexual relations outside marriage—petting, sex perversion, and preoccupation with sex in one’s thoughts and talking."
Though celestial marriage is the only form of marriage recognized as a sacrament, the church permits sex within government-recognized marital unions, the notable exceptions being same-sex marriage, common law marriage, civil unions (in jurisdictions where marriage is available), and polygamy. The church is sensitive about its historical relationship with polygamy, and entry into a polygamous marriage, even where legal, will result in mandatory consideration of church discipline and possible excommunication. Today, the church's teachings allow married couples to decide what is appropriate sexual behavior between themselves. The law of chastity has also been interpreted to include various standards of modesty, which have varied according to cultural norms of the time. Serious offenses of the law of chastity may result in church discipline, including the possibility of excommunication.