When each of us dies, our souls are immediately taken to the presence of God and judged. This is called the Particular Judgment. At this point we begin our eternal destiny. If we are going to hell, our souls go directly there. If we are deemed worthy of heaven, our souls will go directly to heaven, or if we are going to heaven but are in need of purification, we may go to Purgatory first (everyone in Purgatory will eventually go to heaven). Whatever our fate, our souls will stay there until the end of time.
At the Second Coming at the end of time, those Christians still alive will be taken to heaven (what some Protestants think of as of the rapture). Then will occur the General Judgment. At that time the living and the dead will be reunited with their bodies and brought together in God’s presence and judged before all. Those who have already been judged in the Particular Judgment will be brought from wherever their souls were -heaven, hell or Purgatory-- and have their judgment confirmed before all.
After this, time and Purgatory will be no more and all will enter with their souls and bodies into their eternal destiny, either hell or heaven.
This is an extremely bare-bones sketch, so if you want to get the details, see the five articles I linked below:
DISCLAIMER: Catholic Answers has turned over the archive to Catholic-Questions.org and no longer owns, manages, or moderates the forums. For additional apologetics resources please visit www.catholic.com.