Could the pope adopt a child?
There is nothing in Canon Law forbidding it. In fact, Pope Pius IX technically adopted a young boy, who went on to become a Catholic priest.
It should be known that the affair made waves in some communities, especially the Jewish community of the day.
It is commonly believed that Pope Pius IX "adopted" a boy in very extenuating circumstances in 1856 and created an international scandal at the same time.
The Mortara Affair began on this date in 1856 when a contingent of papal police kidnapped 6-year-old Edgardo Mortara from his parent’s apartment in Bologna because Church higher-ups had learned that the child had been secretly baptized by a maid five years earlier when he was seriously ill. Edgardo was whisked to Rome, “adopted” by Pope Pius IX, and eventually became a priest. Jewish organizations and international leaders protested to the Vatican and called for Edgardo to be returned to his parents, but the pope declared that canon law forbade non-Christians in the Papal States to raise a Christian child, even if the child was their own. Protests in France led to the founding of the Alliance Israelite Universelle in 1860, and helped fuel the movement for Italian unification, which overcame the Papal States in 1870. As an adult, Edgardo was sent on missionizing missions to Jews in Germany and the United States, and vigorously sought the beatification of Pope Pius IX — which finally took place in 2000. Mortara did reconnect to his parents and attended his mother’s funeral in Bologna in 1895. He himself died at 88 in 1940. - June 24: The Mortara Affair
Fr. Mortara with his mother and a brother.
Here is what Wikipedia has to say of the Moratara Case.
Pope Pius IX's determination to keep Edgardo developed into a strong paternal attachment. According to Edgardo's memoirs, the pontiff regularly spent time with him and played with him; the Pope would amuse the child by hiding him under his cassock and calling out: "Where's the boy?" At one of their meetings, Pope Pius told Edgardo: "My son, you have cost me dearly, and I have suffered a great deal because of you." He then said to others present: "Both the powerful and the powerless tried to steal this boy from me, and accused me of being barbarous and pitiless. They cried for his parents, but they failed to recognize that I, too, am his father.