“In bringing about the Redemption through suffering, Christ raised human suffering to the level of the Redemption. Thus each man, in his sufferings, can also become a sharer in the redemptive suffering of Christ.” (Pope St. John Paul II)
Catholics believe in the notion of suffering or penance on behalf of others, so that the suffering can actually help them to attain salvation. God can and does apply the suffering of Person A to the soul of Person B: in order to benefit the latter. This is part and parcel of the Body of Christ. A key passage in this regard is Colossians 1:24 (RSV):
Now I rejoice in my sufferings for your sake, and in my flesh I complete what is lacking in Christ's afflictions for the sake of his body, that is, the church,
Paul not only states that he suffered with Christ, but also that the purpose was for the sake of his followers in the Colossian church and elsewhere. We find – if we look closely enough – that this is a rather familiar Pauline theme. We miss it mainly, I believe, because very few of us are inclined to want to embrace suffering:
2 Corinthians 1:6-7 If we are afflicted, it is for your comfort and salvation; and if we are comforted, it is for your comfort, which you experience when you patiently endure the same sufferings that we suffer. Our hope for you is unshaken; for we know that as you share in our sufferings, you will also share in our comfort.
2 Corinthians 4:8-9, 12, 15 We are afflicted in every way, but not crushed; perplexed, but not driven to despair;  persecuted, but not forsaken; struck down, but not destroyed;  So death is at work in us, but life in you. . . .  For it is all for your sake, . . .
2 Corinthians 12:15 I will most gladly spend and be spent for your souls.
Philippians 2:17 Even if I am to be poured as a libation upon the sacrificial offering of your faith, I am glad and rejoice with you all.
2 Timothy 2:10 Therefore I endure everything for the sake of the elect, that they also may obtain salvation in Christ Jesus with its eternal glory.
2 Timothy 4:6 For I am already on the point of being sacrificed; the time of my departure has come.
A further extension of this principle is found in one of the most “mysterious” of all New Testament passages: 1 Corinthians 15:29:
Otherwise, what do people mean by being baptized on behalf of the dead? If the dead are not raised at all, why are people baptized on their behalf?
St. Francis de Sales, in his Catholic Controversy, interpreted this as redemptive suffering for the dead in Christ:
In the Scriptures to be baptized is often taken for afflictions and penances; as in St. Luke chapter 12 [12:50] . . . and in St. Mark chapter 10 [10:38-39] . . . in which places our Lord calls pains and afflictions baptism [cf. Matt. 3:11, 20:22-3; Luke 3:16]. This, then, is the sense of that Scripture: if the dead rise not again, what is the use of mortifying and afflicting oneself, of praying and fasting for the dead?
This sort of redemptive suffering ought to be the goal and behavior of all Christians, for St. Paul also writes that we need to seek to emulate the extraordinary model that he himself provides:
1 Corinthians 4:15-16 . . . I became your father in Christ Jesus through the gospel.  I urge you, then, be imitators of me.
Philippians 3:17 Brethren, join in imitating me, . . .
2 Thessalonians 3:7 For you yourselves know how you ought to imitate us . . .
St. Paul, in turn, imitated Christ:
1 Corinthians 11:1 Be imitators of me, as I am of Christ.
1 Thessalonians 1:6 And you became imitators of us and of the Lord, . . .
Now, we like to rationalize, “well, that was St. Paul. He was one of the greatest saints of all time, and was an apostle specifically called to suffer and to be a martyr.” Unfortunately (for this line of thought), it doesn't work that way. That's “getting off too easy.” But no one ever said that the Christian life was easy.
Popes have reinforced these scriptural motifs and have taught redemptive suffering. Ven. Pope Pius XII stated in Mystici Corporis (1943):
In carrying out the work of redemption Christ wishes to be helped by the members of His Body. This is not because He is indigent or weak, but rather because He so willed it for the greater glory of His spotless Spouse. Dying on the Cross, He left to the Church the immense treasury of the Redemption. Towards this she (the Church) contributed nothing. But when those graces come to be distributed, not only does He share this task of sanctification with His Church, but he wants it, in a way, to be due to her action. What a deep mystery . . . that the salvation of many depends on the prayers and voluntary penances which the members of the Mystical Body offer for that intention, and on the assistance of pastors of souls and of the faithful, especially fathers and mothers of families, which they must offer to our divine Savior as though they were His associates. (my bolding)
Likewise, Pope St. John Paul II wrote these two statements in his Apostolic Letter Salvifici Doloris (1984):
In bringing about the Redemption through suffering, Christ raised human suffering to the level of the Redemption. Thus each man, in his sufferings, can also become a sharer in the redemptive suffering of Christ.
The discovery of the salvific meaning of suffering in union with Christ transforms this depressing feeling. Faith in sharing the suffering of Christ brings with it the interior certainty the suffering person ‘completes what is lacking in Christ’s afflictions’; the certainty that in the spiritual dimension of the work of revelation he is serving, like Christ, the salvation of his brothers and sisters. Therefore he is carrying out an irreplaceable service. (my bolding)