I have a few questions about purgatory. What is it? What is its purpose?
Nothing unclean gets into heaven. Martin Luther once likened men to piles of dung and the grace of Christ to snowfall covering us up and hiding our filth. That’s not how Catholics see it. The path of grace is a transformative journey, conforming us to Christ in totality. If we are piles of dung, then the end product is a transformation into a fruitful flower bed. Ideally we end our life as such, but if we die still attached to sin, God completes that work for us after death, so long as we have faith in Christ. Note that this is still only possible through the merits of Christ. Catholics also belief there are two types of punishment due to sin (1) eternal consequences which is due for mortal sin and (2) temporal comsequemces which is due for all sin. Confession and God’s graces absolves us of eternal punishment, but to satisfy justice, help us change our ways and for our benefit/transformation, and to break our attachment to sin, temporal consequences is still due, even for the saved. Again, this is for our betterment. If we don’t satisfy temporal punishment (or corrective discipline) in this life, there is purgatory after. And this helps conform us to Christ.
Do Catholics have to go through purgatory? Does everyone go through purgatory before going to heaven or hell?
Purgatory is a place of betterment. Everyone who is saved and who dies with any remaining attachment to sin goes through purgatory so that they can enter heaven clean. Those who are damned do not go to purgatory.
Does it have any biblical basis?
Yes, though perhaps implicit and not explicit for those unfamiliar with the doctrine. A few quick points.
(1) Many Jews today also believe in Purgatory. Maybe with a slightly different understanding than the Catholic notion, but still similar.
(2) First century Jews would also have generally believed in a purgatory of some sort, and would have at least a hundred to two hundred years before Christ, as is evidenced in Maccabees II (which Catholics consider canon, but even for those who do not consider it canon, it’s still a work from the 2nd century BC that gives evidence to Jewish beliefs of the time). This context can be applied to some passages from the NT.
I was going to search quotes myself, but I’m on my phone, and this Catholic Answers article contains them:
The early Church writings also don’t suggest that people went to Heaven immediately, excepting the martyrs, and as Church teaching developed, those who gave great witness to the faith in other ways that didn’t lead to their martyrdom (because those persecutions had largely ended). And certainly the early Church, without any doubts, offered prayers for the dead.