In Catholic theology, Purgatory  is a state (or a process, not necessarily a place ) to which one’s soul travels if one has died in a state of grace, but nevertheless retains unremitted venial sins and certain ingrained bad habits and dispositions.
That is, Purgatory is a state for the redeemed who are not yet perfected. It is not a halfway house between Heaven and Hell. In Purgatory, you willingly undergo the quality and quantity of pain and suffering that is uniquely prepared for you so that you may enter Heaven unblemished.
But the dead in Purgatory do not go through this alone. Those of us who are living may provide assistance to them by offering prayers, alms, Masses, indulgences, etc. without, apparently, undermining the point of Purgatory.
Some Protestants, even those who are Purgatory-friendly, have raised an objection to this account. They argue that, if undergoing the pains of Purgatory is necessary for a soul’s purification, then wouldn’t the assistance of the living impair that purification?
That is, if I fast and pray for the poor souls in Purgatory so that they may receive some relief from their suffering, how is that helping their purification if the process requires a particular amount of agony?
The mistake the critic is making is that he is thinking of Purgatory in terms of distributive justice, that the assistance of the living is a rival to the performance of the deceased as if the entire enterprise were a zero-sum game.
He is, of course, not entirely to blame, since the Church and its theologians sometimes use the juridical language of satisfaction and debt to describe Purgatory, its punishments, and the role that the living play in diminishing those punishments.
Nevertheless, as a technical matter, the Church’s understanding of the justice exacted in Purgatory has always been teleological. “Justice,” writes St. Thomas Aquinas , “is so-called inasmuch as it implies a certain rectitude of order in the interior disposition of a man, in so far as what is highest in man is subject to God, and the inferior powers of the soul are subject to the superior.”
Atonement from the Ship in Purgatory by Joseph Anton Koch, c. 1825
This is why two Church councils – Orange  and Trent  – employ the metaphor of the vine and the branches (John 15:1-17) in order to express the relationship between the members of Christ’s body, both living and dead, as they assist each other on the journey to Paradise. The Council of Trent  affirms:
For since Christ Jesus Himself, as the head into the members and the vine into the branches, continually infuses strength into those justified, which strength always precedes, accompanies and follows their good works, and without which they could not in any manner be pleasing and meritorious before God, we must believe that nothing further is wanting to those justified to prevent them from being considered to have, by those very works which have been done in God, fully satisfied the divine law according to the state of this life and to have truly merited eternal life, to be obtained in its [due] time, provided they depart [this life] in grace….
Perhaps a concrete example will help. Peter is a child growing up in the midst of a broken home. As a consequence, he develops vices that lead him to a life of crime and debauchery.
Suppose as a young adult he undergoes a conversion experience, though he finds it difficult to change his old habits. He often finds himself tempted to return to his former life, though he knows that it will destroy him.
Fed up with this internal struggle, he pursues a cloistered life of spiritual discipline that includes rigorous fasting, prayer, studying, meditation, devotion to the poor, and self-flagellation.
After many years, he has acquired a level of self-mastery that truly astounds him as well as the numerous friends he has made in the monastery. But then he has an epiphany that causes him to well up with tears of deep gratitude.
For he looks around and sees, really sees for the first time, what he had taken granted for the past decade: the wonderful architecture, the mountains of books, the opulent sanctuary, the scores of friends he now calls family, all expressions of the love and selfless giving that made his journey possible.
Although the donors, volunteers, and fellow monks that contributed to these magnificent surroundings are often described by others as having helped relieve the burdens of its residents, it would not be accurate to think of this assistance in merely distributive terms, and in fact Peter cannot bring himself to see it that way, or at least not anymore.
Yes, there was pain and suffering, all deserved, of course, and Peter knows that if not for this overabundance of charity his agony would have been worse. But he does not, indeed he cannot, view this charity as a mere amelioration of what could have been.
Rather, he sees his experience as an organic whole, ordered toward both his good and the good of those with whom he lives in fellowship. The charity and the suffering worked in concert for a proper end.
If you understand this story, you understand the Catholic account of Purgatory.