Purgatory is a state of purification for those souls who have died in the grace of God but require cleansing from imperfections before they can enter Heaven.
Before entering Heaven, every trace of attachment to created goods must be eliminated, every imperfection of the soul corrected. The Church uses the word Purgatory to describe the final purification of the souls of those who, having died in grace, have not fully received remission of the temporal punishment for their pardoned mortal sins or their venial sins." As for certain lesser faults we must believe that, before the Final Judgment, there is a purifying fire. He who is truth says that whoever utters blasphemy against the Holy Spirit will be pardoned neither in this age nor in the age to come. From this sentence we understand that certain offenses can be forgiven in this age, but certain others in the age to come" (St. Gregory the Great, Dial., 4,39: PL 77,396; cf. Matthew 12:32). (Cf. CCC 1031,1472)
The punishment of the souls in Purgatory is the delay in seeing God and the knowledge that this delay is their own fault for not having fully repented on earth. These souls also have great joy because they know that they are assured of Heaven. Purgatory is not a lesser form of Hell but rather a state of preparation for Heaven. (Cf. CCC 1030)
Scriptural evidence of Purgatory is found in both the Old and New Testaments. Most strikingly is that Judas Maccabeus offered prayers and atonement for the sins of his fallen soldiers; such prayers for the dead would have been meaningless if the deceased had already reached their final destination (cf. 2 Maccabees 12:44-45). The New Testament also speaks of a purification "as through fire"(cf. 1 Corinthians 3:15). (Cf. CCC 1032-1033)
Prayers for the dead have always been considered a pious duty, an act of charity and justice. The Church frequently remembers the dead—who are also members of the Communion of Saints—in her liturgies, prayers, and indulgences. (Cf. CCC 1475,1498)
If he were not expecting the fallen to rise again, it would have been superfluous and foolish to pray for the dead. 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 absolved from their sin. 2 Maccabees 12:44-46
If someone's work is burned up, that one will suffer loss; the person will be saved, but only as through fire. 1 Corinthians 3:15