The word “purgatory” is not in the Bible, but neither is the word “bible.”
Catholicism is not based on the premise of sola scriptura (only the Bible), but it does find seeds of doctrine in many scriptural passages as well as in Sacred Tradition, which is as valid a vehicle for divine revelation as is Sacred Scripture. What is in the book of 2 Maccabees 12:42–46 (one of the Deuterocanonical books which Protestant Bibles often include but list as Apocrypha) are these key passages:
“He then took up a collection among all his soldiers, amounting to two thousand silver drachmas, which he sent to Jerusalem to provide for an expiatory sacrifice. In doing this he acted in a very excellent and noble way, inasmuch as he had the resurrection of the dead in view; for if he were not expecting the fallen to rise again, it would have been useless and foolish to pray for them in death. But if he did this with a view to the splendid reward that awaits those who had gone to rest in godliness, it was a holy and pious thought. Thus he made atonement for the dead that they might be freed from this sin.”
What is happening here is that Judas Maccabeus (a Jew) had just led a successful revolt against the Syrian King Antiochus IV Epiphanes from 167–160 BC. Some of his soldiers died, though, and it was discovered that a few of them wore amulets around their necks as good luck charms. These were strictly forbidden under Mosaic Law, as the commandments forbade any graven image, and these medallions had an image of a pagan god. Hence, the soldiers were guilty of idolatry. They died in sin even though they died fighting for the freedom of their people and their religion.
Instead of leaving it at that, 2 Maccabees 12:42–46 tells how Judas Maccabeus made supplication (prayer of petition) for the dead soldiers. He also made sure that sacrifices were made to ask God to pardon their sins. Here is an example of a doctrine that centers on the praying for the dead. The only way that prayers for the dead can be of any good or can be praiseworthy is if they actually do some spiritual good. If a person is in hell, no prayers can help; if in heaven, no prayers are needed. If there is a third alternative, a place before heaven where sinners are purged (cleansed) and enter heaven once made clean, then why not call it purgatory from the word for cleansing, purge (purgare in Latin)?
Purgatory is not hell with parole or hell with a time limit. It is not a suburb of hell, close enough to smell the stench, hear the screaming, and feel the heat, but far enough away to leave when it is time to go. If anything, the analogy that works better is that purgatory is a suburb of heaven, close enough to hear the beautiful music and singing, feel the warm sun and cool breeze, and smell the sweet flowers, but far enough away to long and yearn for the day when you can actually be there.
Purgatory is not a spiritual prison or torture chamber. The souls in purgatory want to be there just as a surgeon wants to scrub up before surgery and just as the patient wants the surgeon to scrub up. Sometimes, the dirt is under the fingernails and takes a little effort and elbow grease to dislodge. Sometimes an old stain takes longer to remove than a fresh one. Purgatory is the temporal punishment due to sin.
Sin can merit eternal punishment (hell) or temporal punishment (purgatory). Unforgiven venial sins and already forgiven mortal sins may still have some attachments—the sinner’s fond memories of those sins. Purgatory is a state of cleansing where the soul is detached from former sins. The belief that purgatory exists is a dogma. That anyone or everyone has to go to purgatory is not a doctrine of the Church. Some may have their temporal punishment here (often people say of another, “He had his purgatory on Earth”); others may have it in the afterlife.
The discomfort of purgatory is being so close but not quite there. The hope and joy of those in purgatory is the certain knowledge that one day they will in fact go to heaven. That is guaranteed.