(Isa. 49:9; 1 Pet. 3:19–20; D&C 138; Isa. 61:1–3; D&C 45:28; 128:22)
Christ brought freedom to mortal beings imprisoned by ignorance, sin, apostasy, and death. He also brought deliverance to those on the other side of the veil who had not heard the gospel but would receive it in their spirit prison… . On both sides of the veil, the captives rejoice and praise their God as Christ throws wide the prison doors.
(Jeffrey R. Holland, Christ and the New Covenant [Salt Lake City: Deseret Book Co., 1997], 82–83.)
The phrase has a double meaning. It extends the teaching of the restored gospel to both sides of the veil. The promise to those who are in the prison of apostate doctrines and the bondage of false traditions is that they shall be brought out of “captivity.” … The phrase also refers to the teaching of the gospel to those in the world of the spirits.
(Joseph Fielding McConkie and Robert L. Millet, Doctrinal Commentary on the Book of Mormon, 4 vols. [Salt Lake City: Bookcraft, 1987–1992], 162.)
Peter, also, in speaking concerning our Savior, says that “He went and preached unto the spirits in prison, which sometimes were disobedient, when once the long-suffering of God waited in the days of Noah” (1 Pet. 3:19, 20). Here then we have an account of our Savior preaching to the spirits in prison, to spirits that had been imprisoned from the days of Noah; and what did He preach to them? That they were to stay there? Certainly not! Let His own declaration testify. “He hath sent me to heal the broken-hearted, to preach deliverance to the captives, and recovering of sight to the blind, to set at liberty them that are bruised.” (Luke 4:18.) Isaiah has it—”To bring out the prisoners from the prison, and them that sit in darkness from the prison house” (Isaiah 42:7). It is very evident from this that He not only went to preach to them, but to deliver, or bring them out of the prison house.
(Joseph Smith, Teachings of the Prophet Joseph Smith, comp. by Joseph Fielding Smith [Salt Lake City: Deseret Book Co., 1976], 219.)