Tertullian mentions annual offerings for the departed and a widow praying for her deceased husband. Cyril of Jerusalem describes the Eucharistic commemoration of those who have fallen asleep and says the supplication brings great benefit to the souls for whom it is offered (Catechetical Lecture 23.9–10). John Chrysostom and Augustine likewise discuss prayer, almsgiving, and liturgical commemoration for the dead.
There was dissent—Aerius of Sebaste objected in the fourth century—and the Fathers do not all specify the same mechanism or range of benefit. Still, the practice is plainly earlier than the medieval period and appears across East and West. Orthodox prayer for the departed rests on the Church’s hope in Christ, not on pretending that death makes love or intercession meaningless.
Primary sources
Tertullian, De Corona 3: https://www.newadvent.org/fathers/0304.htm
Cyril, Catechetical Lecture 23.9–10: https://www.newadvent.org/fathers/310123.htm