The Book of Mormon teaches about the salvation of two special groups—those who had not the law and children. Abinadi refers to the former as those who did not have salvation declared unto them. Mormon describes them as follows, they that have no law (Moroni 8:22). Nephi said of them, the atonement satisfieth the demands of his justice upon all those who have not the law given to them (2 Nephi 9:26). These souls are innocent, like children, because they knew not the law of God. The atonement has power to save those in a state of innocence. This principle is taught in the law of sacrifice as found in the law of Moses, If a soul shall sin through ignorance against any of the commandments of the Lord….[the priest] shall do with the bullock as he did with the bullock for a sin offering…the priest shall make an atonement for them, and it shall be forgiven them (Lev 4:2,20).
We don’t often speak of this doctrine because our frame of reference is different. We know the law. We know the consequences of rebelling against the law. But how many millions of people have died without ever hearing the name of Jesus Christ, without ever being taught of a Messiah, without ever understanding the nature of the God who created them? Are they all doomed to suffer in spirit prison and be resurrected to a telestial glory? If so, why are we working so hard to redeem the dead? Those innocent through ignorance will be resurrected according to the justice of God. Some will inherit a celestial glory. Think on the story of Alvin Smith. Joseph Smith records:
I beheld the celestial kingdom of God…I saw Father Adam and Abraham; and my father and my mother; my brother Alvin, that has long since slept;
And marveled how it was that he had obtained an inheritance in that kingdom, seeing that he had departed this life before the Lord had set his hand to gather Israel the second time, and had not been baptized for the remission of sins.
Thus came the voice of the Lord unto me, saying: All who have died without a knowledge of this gospel, who would 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 all 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. (DC 137:1-9)
What DC 137 doesn’t tell us is what will happen to those who died without a knowledge of the gospel but would not have received it with all their hearts. The Lord will have to judge them according to the desire of their hearts. We get a hint of what will happen to them from the D&C, And then shall the heathen nations be redeemed, and they that knew no law shall have part in the first resurrection; and it shall be tolerable for them (DC 45:54, italics added). If it is only tolerable for them, that must not mean a celestial glory. Abinadi uses similar language, saying, they have a part in the first resurrection. It is a part of the first resurrection because they will come forth after those who are “the first fruits” (or those who come forth in the morning of the first resurrection, see DC 88:98). For the most part, they will inherit the terrestial kingdom and will be resurrected as “those who are Christ’s at his coming” (or those who come forth in the afternoon of the first resurrection, see DC 88:99). The above doctrine can be deduced from the available scriptures. See the scriptures already quoted and DC 88:98-9, DC 76:71-73, Heb 5:2, and Mormon Doctrine, p. 640.
Joseph Fielding Smith
"We are taught that we will be punished for our own sins, but what of these millions who sinned ignorantly, not having any knowledge of the mission of the Son of God? According to the divine plan the truth of the gospel must eventually be declared to them, for it is written that ’... the voice of the Lord is unto all men, and there is none to escape; and there is no eye that shall not see, neither ear that shall not hear, neither heart that shall not be penetrated.’ (DC 1:2)
"…We are taught that mankind through the ages will be judged by the privileges and opportunities to know the truth. If a person never had the opportunity to know anything about the plan of salvation, then surely he should not be held accountable for his deeds in the flesh on an equality with the man who knew the truth and then refused to obey it. Thousands of these people who lived in this ignorance were devout and faithful to the doctrines which they had been taught. They cannot be held accountable for their actions which were done in faith and obedience to that which they devoutly believed and had been taught.
“Fortunately the Lord will judge us all by the intent of the heart as well as by our understanding. Therefore it seems that it was only a matter of justice for the Lord to do what Abinadi said he would do and permit these who innocently died in ’their ignorance, not having salvation declared unto them’ to have part in this great resurrection. ” (Answers to Gospel Questions, vol. 4, pp. 76-77)