From the PoV of the Roman Catholic church, baptism is a sacrament for the living. (For that matter, so are all 7 Sacraments). Once the body dies one is subject to judgment, which in the case of individuals is particular judgment. Put simply, we have our whole life to come to Jesus, to open ourselves to salvation, and to accept God's sanctifying Grace. To be baptized is to be reborn in Christ and to wash away the stain of sin.
CCC 1213 Holy Baptism is the basis of the whole Christian life, the gateway to life in the Spirit (vitae spiritualis ianua), and the door which gives access to the other sacraments. Through Baptism we are freed from sin and reborn as sons of God; we become members of Christ, are incorporated into the Church and made sharers in her mission: "Baptism is the sacrament of regeneration through water in the word."
CCC 1214 ... to baptize (Greek baptizein) means to "plunge" or "immerse"; the "plunge" into the water symbolizes the catechumen's burial into Christ's death, from which he rises up by resurrection with him, as "a new creature."
CCC 1215 This sacrament is also called "the washing of regeneration and renewal by the Holy Spirit," for it signifies and actually brings about the birth of water and the Spirit without which no one "can enter the kingdom of God."
To baptize after the body has died and the soul has moved on to judgment would be a case of "closing the barn door after the horse left."
I. THE PARTICULAR JUDGMENT
CCC 1021 Death puts an end to human life as the time open to either accepting or rejecting the divine grace manifested in Christ. The New Testament speaks of judgment primarily in its aspect of the final encounter with Christ in his second coming, but also repeatedly affirms that each will be rewarded immediately after death in accordance with his works and faith. The parable of the poor man Lazarus and the words of Christ on the cross to the good thief, as well as other New Testament texts speak of a final destiny of the
soul--a destiny which can be different for some and for others.
1022 Each man receives his eternal retribution in his immortal soul at the very moment of his death, in a particular judgment that refers his life to Christ: either entrance into the blessedness of heaven-through a purification or immediately, -- or immediate and everlasting damnation.
At the evening of life, we shall be judged on our love. (~St. John of
the Cross, Dichos 64.)
Put another way, if you don't have a relationship with Christ while living, there is no basis for a favorable judgment. (I suppose that hope is always an option, part of why the Catholics pray for the dead ... but that's getting off topic). In Matthew (7:21 – 23) Jesus teaches that some will come to judgment and be told "Depart from me, I never knew you." If we don't have a relationship with Him before death, this passage points to us being out of luck at judgment. The foundation of that relationship is the gateway sacrament: Baptism.
Caveat: the above isn't the only way to parse Matthew 7's larger point, but I've heard this referred to on multiple occasions among Catholics, both lay and clergy, when emphasizing how important it is to have a relationship with Christ.
For a better understanding of Catholic views on Baptism, articles 1213-1228 in the Catechism are helpful.