Stark (Bearing False Witness) notes that while slavery was hardly questioned in antiquity, the Catholic Church gradually eliminated it in Western Europe during the Middle Ages. When Aquinas condemned slavery as "contrary to natural law," this soon became the official Church position.
Nevertheless, some Church officials, even some popes, continued to own slaves. But some popes engaged in fornication and had children out of wedlock, despite official Church opposition to sex outside of marriage. And the Spanish and Portuguese imperialists often continued to enslave people, despite Church opposition. For instance, Spain colonized the Canary Islands in the early 1400s, and started enslaving the islanders. This prompted Pope Eugene IV to declare that "these people are to be totally and perpetually free and are to be let go without exaction or reception of any money" (quoted on 171).
In the 1500s, Pope Paul II asserted that "the same Indians and all other peoples--even though they be outside the faith... should not be deprived of their liberty or their other possessions... and are not to be reduced to slavery..." (quoted on 172).
The Inquisition took up the matter in the 1600s, and asked:
"Whether it is permitted to buy, sell, or make contracts in their respect Blacks and other natives who have harmed no one and have been made captives by force or deceit?"
It declared, "Answer: no."
In fact, the papacy denounced slavery in 1462, 1537, 1639, 1741, 1815, and 1839.