That is true, the technical term is prayer for the Church Suffering or "for the souls in Purgatory".
On another note: It is true that the Maccabee soldiers apparently had committed a mortal sin, which should according to the teaching of the Church send them to Hell and not Purgatory. But then, firstly, we are not attempting to re-create the Jewish theology of the period.
Secodnly, they prayed for them, so they hoped for Divine mercy, given in particular that they were, in Christian parlance, martyrs for the faith regardless of the sin. Martyrdom helps to redeem sin, and in the Christian era we should not presume that a Christian soldier died in mortal sin despite any evidence that he did. Despite some deviations known to happen in the past, a Mass for the dead can be offered for all regardless of any presumptions one might make about their state at death. In fact we are told by Christ not to judge the state of another man's soul. We are to hope that mercy was given the deceased, and should he in fact be condemned to Hell, no sin is committed by praying for his soul anyway.
That, perhaps, is too broad. Some cases are restricted to a private mass, and an unrepentant sinner who was excommunicated, or whose apostasy gave scandal, cannot be buried in the Church, nor can the unbaptized. But the tradition asks these rules to be interpreted most liberally, so that whenever a chance of repentance exists, the benefit is afforded. See details under PetroniusMaximus's link in 124.