It is universally agreed among Christians that there will be no sin in Heaven. It should also be largely an agreed fact that at least most of us sin and/or have some sort of attachment to sin. So, then the question becomes, what happens to that sin is still on our soul or that attachment to sin if we have it at our death?
Purgatory is the process in which the sin that is on our soul and that attachment for sin is cleansed at our death. It only makes sense that if we die as sinners and go to Heaven, where there can be no sin, then we must undergo some sort of cleansing process before entering Heaven. Saint Paul refers to this process as being saved “as through fire” in 1 Corinthians 3:11-15.
11 For no other foundation can any one lay than that which is laid, which is Jesus Christ. 12 Now if any one builds on the foundation with gold, silver, precious stones, wood, hay, stubble— 13 each man’s work will become manifest; for the Day[a] will disclose it, because it will be revealed with fire, and the fire will test what sort of work each one has done. 14 If the work which any man has built on the foundation survives, he will receive a reward. 15 If any man’s work is burned up, he will suffer loss, though he himself will be saved, but only as through fire.1 Corinthians 3:11-15