While the concept of purgatory is often thought of as a medieval creation, the roots of the Catholic Church's beliefs come both from the Bible and the teachings of the early Church.
One of the ways the Church's belief in purgatory is evident in the early Church is how the deceased were remembered in prayers.
St. John Chyrsostom in the 4th century refers to praying for the deceased during Mass in one of his letters, as quoted in the 19th-century book Charity for the Suffering Souls.
The Apostles did not ordain without good reason a commemoration of the departed to be made during the celebration of the sacred mysteries; for from it the deceased draw great gain and help. Why should prayers for them not placate God, when, besides priest, the whole people stand with uplifted hands whilst the august Victim is present on the altar? True it is offered only for such as departed hence in the faith.
Fathers of the Church
St. Gregory of Nyssa writes a similar affirmation in this tradition.
The apostles and disciples of Christ have handed down to us what since has obtained the force of law everywhere in the Church of God, namely that the memory of those that died in the true faith be recalled in the celebration of the sacred and illustrious mystery.
St. Augustine also famously wrote about St. Monica asking him to remember her at the altar.
Lay this body anywhere be not concerned about that. Only this I beg of you, that wheresover you be, you make remembrance of me at the Lord's altar.
Even Tertullian in the 2nd century recorded this belief in praying for the deceased at Mass.
On the anniversaries of the dead, we offer the Holy Sacrifice for the departed. Even though Scripture did not warrant this, the custom originates in tradition; it was confirmed by universal adoption and sanctioned by faith.
These quotes are a small portion of texts from the early Church that support an uninterrupted belief in purgatory.