William of Ockham has already speculated on a Pope converting to Islam:
Master: Let us assume that someone accuses another before the pope of being a heretic because the accused supposedly holds and asserts that the Christian faith is false, that the law of the Muslims should be embraced, and that Christ was a prophet both false and discredited. After the accusation and the ensuing judicial process, the pope renders a definitive judgement to the effect that the person accused is not a heretic because all of the aforementioned theses stated and asserted by him are true.
Student: Although this is a case that never happened and perhaps never will, I find it difficult to assert that it smacks of impossibility. For it seems that one cannot clearly demonstrate either by Holy Writ or by the doctrine of the church that no future pope will be the Antichrist. It is indeed probable that many Christians through their ancestors who were converted to the faith have long established roots to the tribe of Dan, from which some believe that the Antichrist will be born [For a discussion of this tradition see David Burr, Olivi's Peaceable Kingdom, Philadelphia 1993, p. 150]. And even in our time it is quite possible for someone from that tribe to accept the Christian faith, to have a son born to him, that son being subsequently elected pope, and afterwards clearly showing himself to be the Antichrist. And thus it cannot be known whether some Christian and future pope, with roots in the tribe of Dan, will be the Antichrist. It is, however, established that the Antichrist will unambiguously teach that the law of the Christians is false and that Christ was a false prophet. And the described case does not appear impossible because it is not known that no future pope will submit to the sect of the Muslims. For it may come to pass that even a pope who was at first catholic would begin to consider that the sect of the Muslims was better than the law of the Christians. This pope could initially develop such a strong secret friendship with the Muslims, that having summoned their military might to his side he would dare to openly assert that the Christian law was false and unjust, and force Christians to accept the law of the Muslims. Since it is indeed an established fact that many Christians (including clerks and religious) have been converted to the sect of the Muslims, it does not seem implausible that even a pope might arrive at such a huge insanity. For since a pope is not confirmed in faith (just as no others are), the same point must be contended in his case as is in that of others as to the possibility of being converted to the Muslims. Having therefore presented the suggested exemplary case, proceed to argue in favour of the aforementioned assertion. William Of Ockham
'See how I rend myself, see how mangled is Mohammed!'