The Catholic Church, instructed by the Holy Spirit and in accordance with sacred Scripture and the ancient Tradition of the Fathers, has taught in the holy Councils and most recently in this ecumenical Council that there is a purgatory and that the souls detained there are helped by the acts of intercession (suffragia) of the faithful, and especially by the acceptable sacrifice of the altar.
Related Canon 30 from the Council of Trent's Decree on Justification (Sixth Session, 1547)
30. If anyone says that after the grace of justification has been received the guilt is so remitted and the debt of eternal punishment so blotted out for any repentant sinner, that no debt of temporal punishment remains to be paid, either in this world or in the other, in purgatory, before access can be opened to the kingdom of heaven, anathema sit ["let him be anathema" or excommunicated].
1030 All who die in God's grace and friendship, but still imperfectly purified, are indeed assured of their eternal salvation; but after death they undergo purification, so as to achieve the holiness necessary to enter the joy of heaven.
1471 "An indulgence is a remission before God of the temporal punishment due to sins whose guilt has already been forgiven, which the faithful Christian who is duly disposed gains under certain prescribed conditions through the action of the Church which, as the minister of redemption, dispenses and applies with authority the treasury of the satisfactions of Christ and the saints."81 [Paul VI, apostolic constitution, Indulgentiarum doctrina, Norm 1.]
i) If, for the sake of argument, you accept the Tridentine premise, then there's a certain inner logic between purgatory and indulgences. In the Tridenine definition, purgatory involves retributive punishment. It's about guilt. Paying off your debt. Same thing with the treasury of merit. The "satisfactions" of Christ and the saints presume the same forensic category.
If you think there's a treasury of merit which the pope can tap into, then, within that framework, it makes sense to say your purgatorial sentence is subject to commutation or pardon. Someone else paid the debt. Someone else made restitution on your behalf.
ii) Mind you, even on its own terms, that's dubious. It operates with a quantitative view of guilt, as if as sinner has incurred x units of guilt which may be offset by x units of merit. But why think guilt is quantitative rather than qualitative? There are other problems, but I'll pass on that.
iii) Another problem is the contradiction between the traditional conception of purgatory and the contemporary conception (in Roman Catholicism). The contemporary conception has undergone a paradigm-shift from retributive justice to remedial justice. From objective guilt to subjective corruption. Purgatory is now a process of postmortem sanctification to purify the decedent before he is ready for heaven.
But even if you grant that for the sake of argument, it clashes with the traditional theology of indulgences. If purgatory is necessary to complete your sanctification, then that process can't be accelerated or short-circuited by a papal indulgence. Rather, that would operate at its own pace. However long it takes you to eradicate your sinful disposition. An indulgence would prematurely convey you to heaven, before the refining fire has had time burn away the dross.
So you end up with a hybrid theology of purgatory and indulgences, combining disparate elements from two incompatible paradigms.