It was a very early custom Christians, unlike pagans, to pray for the dead, and as St. Augustine pointed out, there's no point in praying for souls already in heaven and hell.
In his study examining the origins of the Jewish tradition of praying for the dead, Solomon Reinach nicely observes: "Pagans prayed to the dead, Christians prayed for the dead" ("De lorigine des prières pour les morts," Revue des Etudes juives 41 [1900]: 164).
Oh, I see. So, it's just a tradition, but not authorized by God. Okay. But what about this word Pergatory? I can't find it in my Bible.