Mormon Underwear or Garments
Mormon undergarments, or simply garments; are directly related to Mormon temple worship. In the temple, Mormons perform several rituals the most common being what is called the Endowment.
Mormons who receive the Endowment are given the garment also known as the Garment of the Holy Priesthood as part of the preparation for the ceremony itself. Thereafter, Mormons are expected to wear the garment as a continual reminder of the covenants they make with God in the Endowment ceremony.
Todays garments are no different than a standard t-shirt and long boxer shorts. However, they do have symbolic markings which are intended to remind the wearer of their commitments made to God.
Garments are entirely symbolic. A common misconception amongst both Mormons and non-Mormons alike is that the garment provides some sort of supernatural or divine protection from bodily harm. Thus, the garment is often referred to by some as magic underwear. This misconception is a Mormon folk-belief and is NOT part of official Mormon doctrine. A careful study of the Endowment (which I will not offer here) indicates that the garment offers spiritual protection through the wearers commitment to spiritual covenants and makes no promise of physical protection. Plenty of Mormons have been injured and killed while wearing their magic underwear.
The garment was introduced as part of temple worship by Joseph Smith, Mormonisms founder during the Nauvoo period sometime around 1842-43. Smith was heavily influenced by the Old Testament and often used OT conceptions of priesthood as the basis for the temple worship he introduced.
For example, consider several versus from the book of Exodus:
Exodus 40:13-15 13 And thou shalt put upon Aaron the holy garments, and anoint him, and sanctify him; that he may minister unto me in the priest's office. 14 And thou shalt bring his sons, and clothe them with coats: 15 And thou shalt anoint them, as thou didst anoint their father, that they may minister unto me in the priest's office: for their anointing shall surely be an everlasting priesthood throughout their generations.
Exodus 28:2-3 And thou shalt make holy garments for Aaron thy brother for glory and for beauty. 3 And thou shalt speak unto all that are wise hearted, whom I have filled with the spirit of wisdom, that they may make Aaron's garments to consecrate him, that he may minister unto me in the priest's office.
It is also possible that Smith was influenced by some NT text as well:
Revelation 3:4-5 4 Thou hast a few names even in Sardis which have not defiled their garments; and they shall walk with me in white: for they are worthy. 5 He that overcometh, the same shall be clothed in white raiment; and I will not blot out his name out of the book of life, but I will confess his name before my Father, and before his angels.
As the Endowment is intended to give both men and women the opportunity to minister to God in priesthood ritual, it makes sense that Joseph Smith introduced special garments as part of the preparation for the Endowment. Smith also introduced other ritual temple clothing but a discussion of those particulars is beyond the scope of this question.
Joseph Smith was also influenced by his modern surroundings in designing garments. Thus, as Joseph Smith was a Mason, he included some Masonic symbols as part of the temple garment. This being said, however, it is important to note that the garment is merely influenced by Joseph Smiths masonry and was not strictly borrowed from Masonry.
Over time, the garment has changed. Originally it was a full length undergarment covering the entire body from wrist to ankle. Eventually this was shortened to be a one-piece garment which extended to the upper arms and knees. Todays garment is split into two pieces just as standard underwear; although some Mormons prefer to wear one-piece garments. Garments come in many different material types and are typically white. The one exception to this is for Mormons who serve in the military and are required to wear green undergarments. For such cases, the Mormon church has produced garments to match the military requirements.