Salvation for the dead was revealed to Joseph Smith upon the completion of the Kirtland Temple.
First came the vision of the prophet’s brother (Alvin, who had passed away in 1823) at a meeting held in the Kirtland Temple, January 21, 1836, just prior to its dedication. (This vision and revelation can be found in History of the Church, Vol. II, pg. 380)
All who have died without a knowledge of this gospel who could have received it if they had been permitted to tarry, shall be heirs of the celestial kingdom of God; also all that shall die henceforth without a knowledge of it, who would have received it with their hearts, shall be heirs of that kingdom, for I, the Lord, will judge all men according to their works, according to the desire of their hearts.
Next and even more significant was the vision given to the prophet and Oliver Cowdery shortly after the dedication of the temple, found in D&C 110:13-16. “As there shown, Elijah, who has been expected by the Jews for three thousand years, and whose symbolic entrance is typified every Passover night in all Jewish households by opening the door to admit his coming as the forerunner of Messiah, came to the Prophet Joseph Smith at the Passover period, April 3, 1836, presenting to him the keys to turn the hearts of the fathers to the children and the children to their fathers, committing the keys of this dispensation into the hands of the great latter day prophet.”
Later, after arriving in Nauvoo, the first thing Joseph determined to do was build another temple. D&C 124: 26-48 was given to Joseph Smith as a commandment to build a temple “in order to do the work of the Lord.” He was told that if the Saints did not obey this commandment they would all be under condemnation.
The Kirtland Temple did not have a baptismal font in it, so the early Saints eagerly awaited the building of the Nauvoo Temple in order to fulfill this new and wonderful commandment. As is common throughout church history, the Lord gives the commandment, but adds detailed instruction little by little by the spirit. The early Saints began baptizing for the dead, but did so with little organization. Men were baptized for the women, and women for the men.
A year later, another revelation was given to Joseph explaining the need for a Recorder to watch over each of the ordinances performed in the temple, and to carefully record them and store them. (D&C 127:6-9) Today, each temple has its own Recorder, who carefully records all the work that is done in that temple.
The following information comes from Relief Society lesson plans covering Jan-Mar of 1920, where Joseph Smith is quoted from History of the Church, Vol. VI, page 251:
“What is this office and work of Elijah? It is one of the greatest and most important subjects that God has revealed. He should send Elijah to seal the children to the fathers, and the fathers to the children. “I wish you to understand this subject, for it is important; and if you will receive it, this is the spirit of Elijah, that we redeem our dead, and connect ourselves with our fathers which are in heaven, and seal up our dead to come forth in the first resurrection; and here we want the power of Elijah to seal those who dwell on the earth to those who dwell in heaven. This is the power of Elijah and the keys of the kingdom of Jehovah. Again: The doctrine or sealing power of Elijah is as follows: If you have power to seal on earth and in heaven, then we should be wise. The first thing you do, go and seal on earth your sons and daughters unto yourself, and yourself unto your fathers in eternal glory. * * * I will walk through the gate of heaven and claim what I seal, and those that follow me and my counsel.”
The prophet gave even more light upon the subject, on May 9, 1844, “My text is on the resurrection of the dead, which you will find in the 14th chapter of John—’In my Father’s house are many mansions.’ It should be, ‘In my Father’s kingdom are many kingdoms,’ in order that ye may be heirs of God and joint heirs with me. I do not believe the Methodist doctrine of sending honest men and noble-minded men to hell, along with the murderer and the adulterer. They may hurl all their hell and fiery billows upon me, for they will roll off me as fast as they come on. But I have an order of things to save the poor fellows at any rate, and get them saved; for I will send men to preach to them in prison and save them if I can. There are mansions for those who obey a celestial law, and there are other mansions for those who come short of the law, every man in his own order. There is baptism, etc., for those to exercise who are alive and baptism for the dead who die without the knowledge of the gospel.”
This principle occupied the last closing thoughts of the Prophet, as is shown by these extracts, for the last discourse quoted occurred only a month before his own martyrdom.
In the Relief Society Magazine April 1920 issue, there is an article written by James W. Lesueur, a stake president in Arizona, who shares an experience he had after his brother died.
Shortly after lying down, and while thinking of my brother, my spirit left my body… and by my side a personage dressed in robes of white whom I understood to be my guardian angel. I went with him, traveling like lightning, a great distance, in a very few moments, and came into a great city which I understood to be a city containing those who had died without receiving the gospel. In the midst of this city stood a large building, plain but beautiful, covering an entire block several stories high. My guardian angel said to me, “We are going in here,”… I looked around the large room and estimated that there were as many people in that room as could find room in the Salt Lake Tabernacle.
Presently, I heard someone speaking, and listened to a sermon on the first principles of the gospel, and I thought how similar to sermons of the missionaries out in the fields, until he came to the treatment of the necessity of baptism. He then explained that inasmuch as they had died without the opportunity of baptism, that it was necessary that this ordinance should be performed by someone living upon the earth who would attend to it for them. He also explained that confirmation would follow in order to confer the Holy Ghost, which also would be done vicariously by a living proxy. When he had completed his sermon he turned and looked at me, and I beheld that it was my brother, Frank.
All this evidence has given me to understand that it was a vision in reality, and a testimony to me that the work of salvation for the dead is being carried on, under the supervision of the Lord, by holy men and women who have lived upon the earth, and the work that we are doing in our holy temples is indeed the work of the Lord, to bring about their salvation. Those engaged in this splendid work are saviors on Mount Zion.
In the early days of the church, Relief Society sisters eagerly returned back to their eastern homes to gather family names so they could do the work for their loved ones. Eliza, Zina, Emmeline, many of them who took seriously this saving ordinance. Eliza, Zina, and Bathsheba served as temple matrons in the Endowment House while serving as our Relief Society presidents. All their spare time was spent in the temple. Susa Young Gates wrote the first genealogical lesson plans and Relief Society was said to be synonymous with Genealogy, because it was the sisters who did the research, the organizing of the records, and led the way in doing the temple work.