Aerius of Pontus in the fourth century rejected praying for the dead since he believed it promoted moral laxity in this life: "If the prayer of the people here has benefited the people there, no one would practice piety or perform good works." His objection was refuted by Augustine of Hippo.
By St. Augustine of Hippo
The prayer either of the Church herself or of pious individuals is heard on behalf of certain of the dead; but it is heard for those who, having been regenerated in Christ, did not for the rest of their life in the body do such wickedness that they might be judged unworthy of such mercy, nor who yet lived so well that it might be supposed they have no need of such mercy. (The City of God Bk. 21.24)
But by the prayers of the holy Church, and by the salvific sacrifice, and by the alms which are given for their spirits, there is no doubt that the dead are aided, that the Lord might deal more mercifully with them than their sins would deserve. The whole Church observes this practice which was handed down by the Fathers: that it prays for those who have died in the communion of the Body and Blood of Christ, when they are commemorated in their own place in the sacrifice itself; and the sacrifice is offered also in memory of them, on their behalf. If, then, works of mercy are celebrated for the sake of those who are being remembered, who would hesitate to recommend them, on whose behalf prayers to God are not offered in vain? It is not at all to be doubted that such prayers are of profit to the dead; but for such of them as lived before their death in a way that makes it possible for these things to be useful to them after death. (Sermons 172.2)
During the time, moreover, which intervenes between a man’s death and the final resurrection, the soul dwells in a hidden retreat, where it enjoys rest or suffers affliction just in proportion to the merit it has earned by the life which it led on earth. Nor can it be denied that the souls of the dead are benefited by the piety of their living friends, who offer the sacrifice of the Mediator, or give alms in the church on their behalf. But these services are of advantage only to those who during their lives have earned such merit, that services of this kind can help them. For there is a manner of life which is neither so good as not to require these services after death, nor so bad that such services are of no avail after death; there is, on the other hand, a kind of life so good as not to require them; and again, one so bad that when life is over they render no help. Therefore, it is in this life that all the merit or demerit is acquired, which can either relieve or aggravate a man’s sufferings after this life. No one, then, need hope that after he is dead he shall obtain merit with God which he has neglected to secure here. And accordingly it is plain that the services which the church celebrates for the dead are in no way opposed to the apostle’s words: "For we must all appear before the judgment-seat of Christ; that every one may receive the things done in his body, according to that he has done, whether it be good or bad;" for the merit which renders such services as I speak of profitable to a man, is earned while he lives in the body. It is not to every one that these services are profitable. And why are they not profitable to all, except because of the different kinds of lives that men lead in the body? When, then, sacrifices either of the altar or of alms are offered on behalf of all the baptized dead, they are thank-offerings for the very good, they are propitiatory offerings for the not very bad, and in the case of the very bad, even though they do not assist the dead, they are a species of consolation to the living. And where they are profitable, their benefit consists either in obtaining a full remission of sins, or at least in making the condemnation more tolerable. (The Enchiridion 109-110)