Those in spirit prison have the opportunity to learn the gospel of Jesus Christ, repent of their sins, and receive the ordinances of baptism and confirmation (by proxy) through the work done in modern day LDS temples. When they do, they may enter paradise, where those who have accepted Jesus Christ wait for Judgment (Doctrine & Covenants 138:30–35).
The 1 Peter 3:19 phrase, with its reference to Christ having already visited the spirits in question, is usually interpreted in line with the image of the Harrowing of Hell.
The concept that the dead await a general resurrection and judgment either in blessed rest or in suffering, in accordance with a particular judgement already passed on each individually, was a common 1st-century Jewish belief (see Lazarus and Dives and bosom of Abraham). A similar concept is taught in the Eastern Orthodox Church, was championed by John Calvin (who vigorously opposed Luther's doctrine of soul sleep), and is reflected in some early church writers. It appears in Islam as barzakh, and also in 9th-century Zoroastrian writing (after and perhaps due to two centuries of Muslim influence and several more of Christian influence).