The doctrine was developed in the church in the Middle Ages and seemed to satisfy concerns about how those who live unrighteously through most of their life can go straight to heaven as well as those who lived righteously. Gifts to a worthy charity or the church would replace doing actual penatory acts, and also generated lots of revenue for the church during a time when corruption was increasing greatly. Martin Luther opposed the doctrine of purgatory on the grounds that it was not taught in the Scriptures and contrary to the notion that Christ's atonement was sufficient to pay for all sins. All modern churches that stem from the Protestant Reformation reject the notion of purgatory. The Roman Catholic church reaffirmed the doctrine of purgatory at the Council of Trent in 1546 and it has been part of Roman Catholic doctrine ever since.
Purgatory is said to be supported by passages in the apocrypha.
These are books written from around 250 B.C. till near the time of Christ. While they were known to both the New Testament writers and the early church, they were not considered authoritative, nor part of the Old Testament canon with a few notable exceptions. Thus, the Roman Catholic church still affirms these books as being in the canon of Scripture and all Protestant churches do not. For more on the apocrypha, click here .