Megan McLaughlin traces the development of prayer for the dead in stages as follows (all the quotes are from her book):
1. Christians replace pagan funeral rites with the Eucharist. “…the central rite of the church – the celebration of the eucharist – was also associated with the funerals of Christians from at least the second century on. What part it played in those funerals is less clear…the practice of offering the eucharist for the dead after they were laid to rest is well attested. It seems to be related to pre-Christian customs, common throughout the Mediterranean region, which called for sacrifices at the tomb of a dead person on set days after the burial. The Christian communities substituted eucharistic sacrifices for these traditional ones at an early date.”
2. The main functions of the liturgy were clericalized and the laity retreated from the liturgy after Constantine. “…the laity began to lose their active role in the services of the ecclesia from the fourth century on. They retained some liturgical functions, but as time passed their presence was no longer necessary for the performance of the liturgy. Gradually, then, liturgical prayer became an activity that the clerical orders performed on behalf of the Christian community, rather than in concert with the order of the laity.”
3. The influx of converts post-Constantine produced doubt about the salvation of the baptized. “As the church found a recognized place in society and attracted a growing number of converts, a new pessimism became evident in the writings of church leaders and in the prayers of the liturgy. Awareness of the sin to be found within a larger and in some ways more worldly church grew, and as a result confidence in the salvation of the faithful slowly began to give way to anxiety about the fate of the individual Christians after death. But as their fate began to seem less certain, their need to be remembered in the liturgy began to seem more urgent. It is no accident that visions in which the dead appear asking for prayers became increasingly common in late antiquity. The anxiety expressed in such visions led to a redoubling of liturgical efforts on behalf of the departed faithful. The development of prayer for the dead can, then, be seen as a response to the now keener perception that the dead needed help.”
4. Funeral liturgy was formalized and the importance of the viaticum (eucharist given to the dying) emerged.
5. The church building began to be the location of funeral rites and sometimes burial. “In the first three centuries, funeral processions had apparently moved directly from the home or the place of death to the cemetery. However, after the persecutions came to an end and it became possible to build permanent, sometimes sumptuous settings for the Christian cult, funeral processions were directed into these new basilicas for part of the burial service. The more privileged members of the Christian community were sometimes even buried inside churches, in order to be close to the relics they contained. From the fourth century on, such “privileged” burials occurred in the suburban basilicas built over the tombs of the martyrs. By the fifth century, the relics of the saints were being transferred into urban basilicas, and the bodies of the dead followed.”
6. Communion was sometimes given to the dead bodies themselves! “There are also some indications that the bodies of the dead awaiting burial were sometimes present during the celebration of the eucharist. However, there seems to have been some disagreement within Christian communities about whether this was appropriate. In 393, the Council of Hippo forbade the custom of celebrating the eucharist in the presence of the dead, and even giving communion to “inanimate cadavers.” […] A diocesan synod in Gaul in the late sixth century warned against giving communion or the kiss of peace to the dead, suggesting that similar practices were current there. Many church leaders were willing to accept the presence of the dead, so long as a corpse was not treated like a living member of the assembly.”
7. The dead were remembered with eucharists on set days after their burial. “The eucharist continued to be offered on set days after the burial in late antiquity. In the West, the most common days for celebrations came to be the third, seventh and thirtieth after burial, and the anniversary of death. These offerings were public events within the Christian community, at which a great many people might be present. Sometimes, too, the eucharist would be celebrated even more often for the recently deceased.”
It is not difficult to see from this devolution how prayers for and to the dead came into being. Absorption of pagan rituals, influx of un-converted converts, formalization of the liturgical practice, and professionalization of the clergy in performing these rites even with no laity present. Corruption followed corruption. As an aside, one wonders how busy the priests must have been if they were constantly performing eucharists for the anniversary of the dead!
All of this points to the legitimacy of the Magisterial Reformers in rejecting such practices and returning to the authority of God’s Word on the subject.