The offering of Mass for the repose of the soul of the faithful departed is linked with our belief in Purgatory. We believe that if a person has died fundamentally believing in God but with venial sins and the hurt caused by sin, then God in His divine love and mercy will first purify the soul After this purification has been completed, the soul will have the holiness and purity needed to share in the beatific vision in heaven. While each individual stands judgment before the Lord and must render an account of his life, the communion of the Church shared on this earth continues, except for those souls dammed to hell.
The Vatican Council II affirmed, "This sacred council accepts loyally the venerable faith of our ancestors in the living communion which exists between us and our brothers who are in the glory of heaven or who are yet being purified after their death..." (Dogmatic Constitution on the Church, No. 51). Therefore, just as we pray for each other and share each other's burdens now, the faithful on earth can offer prayers and sacrifices to help the departed souls undergoing purification, and no better prayer could be offered than that of the Holy Sacrifice of the Mass.
Pope Leo XIII in his encyclical Mirae Caritatis (1902) beautifully elaborated this point and emphasized the connection between the communion of saints with the Mass: "The grace of mutual love among 'The living, strengthened and increased by the Sacrament of the Eucharist, flows' especially by virtue of the Sacrifice [of the Mass]' to all who belong to the communion of saints For the communion of saints is simply... the mutual sharing of help, atonement, prayers, and benefits among the faithful, those already In the heavenly fatherland, those consigned to the purifying fire, and those still making their pilgrim way here on earth. These all form one city, whose head is Christ, and whose vital principle is love. Faith teaches that although the august Sacrifice can be offered to God alone, it can nevertheless be celebrated in honor of the saints now reigning in heaven with God, who has crowned them, to obtain their intercession for us, and also, according to apostolic tradition, to wash away the stains of those brethren who died in the Lord but without yet being wholly purified."
Think of this point: The Holy Mass transcends time and space, uniting the faithful in heaven, on earth and in purgatory into a Holy Communion, and the Holy Eucharist Itself augments our union with Christ, wipes away venial sins, and presences us from future mortal sins (cf. Catechism, No. 1391-1396). Therefore, the offering of Mass and other prayers or sacrifices for the intentions of the faithful departed are good and holy acts. This practice is not new. The Catechism asserts, "From the beginning the Church has honored the memory of the dead and offered prayers in suffrage for them, above all the Eucharistic Sacrifice, so that, thus purified, they may attain the beatific vision of God" (No. 1032).