Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
It is disliked to repeat the Azan while in the toilet according to the well-known opinion of the four Madhabs, because it contains remembrance of Allah, but it is permissible to say it internally (in one’s heart), and when a person finishes relieving himself then he can say it with his tongue (outside the toilet).
Al-Tahthawi said in his footnotes of Maraqi al-Falah: ‘If someone hears the call to the prayer in the toilet, he answers in his heart, and when he finishes he says it with his tongue (outside the toilet)’.
Allah knows best.