"Where do I go when I die?" This is perhaps one of the most sought after questions in this life. That unavoidable time will come when we will all die. Though death is never an easy thing, we can gain peace knowing that death is indeed part of Heavenly Father's plan for us.
When we die, our bodies and spirits are temporarily separated. Our bodies go down into the grave and our spirits go to a place called the spirit world. There are two parts to this spirit world - spirit prison and spirit paradise. Those who accepted the gospel of Jesus Christ and chose to obey God in this life will go to spirit paradise. They will live in a state of happiness, peace, and rest from troubles and care. Death does not change our personalities or characteristics
(Alma 34:34).
Those who chose not to obey in this life and did not repent will go to spirit prison and will live in a state of unhappiness. Also, there are so many people that never had the opportunity to hear of Jesus Christ's gospel while on this earth. It would be very unfair for God to just leave them, and many others, in a state of endless misery. Since our Heavenly Father is so loving, he has provided a way for those spirits in prison to achieve happiness in paradise. In spirit paradise, the gospel will be preached to those in spirit prison - those who did not obey the gospel or have the opportunity to hear it while on earth.
Jesus Christ died on the cross and was resurrected on the third day. So.. What was Jesus doing on those three days before He was risen again? He was teaching those spirits in prison (See:
1 Peter 3:19, (1 Peter 4:6).
We will remain in the spirit world until we are resurrected.
Other "spirit world" scripture references:
D&C 138