Why does Dante put the virtuous pagans and babies in Limbo? Did that go against the medieval church's teachings?
During Dante's time, the Roman Catholic Church, at the Council of Trent, recognized that righteous people who died before Christ came should have a chance for redemption. Because they lived virtuous lives, they were considered to be as innocent as babies and worthy of salvation. The church declared that these souls were being kept in Limbo, the first circle of Dante's hell, until they were deemed fit to enter heaven.
The medieval church seems to have been split on the belief in salvation for virtuous pagans. On the one hand, the church established the tradition that during the three days he was in the tomb, Christ was in hell converting those pagans. Thus the concept of a place called Limbo was developed in the Middle Ages. On the other hand, however, some church leaders refuted this idea. Augustine was one opponent who believed that pagans could gain salvation only during their lifetime. See the book The Virtuous Pagan in Middle English Literature. (I tried to paste a link below was unable to). The question was settled at the Council of Trent when Thomas Aquinas gave it his endorsement.