Praise be to Allah.
What the scholars have stated is makrooh is reading Qur’aan or remembering Allaah in toilets, because these are impure places and are abodes of the devils. The believer should respect his Lord and not mention Him in these places. As for listening to the Qur’aan when doing ghusl or relieving oneself, there is no sin in it, because it is not mentioning Allaah inside the toilet, as the recorder is outside the bathroom.
There are a few reports from the salaf (may Allaah have mercy on them) about their keenness to make good use of their time, from which this ruling may be derived.
Imam Abu Haatim al-Raazi and his son ‘Abd al-Rahmaan.
‘Abd al-Rahmaan was asked about his hearing a lot of hadeeth from his father, and his asking him a great deal about ahaadeeth and their narrators. He said: My father would be eating, and I would read to him, and he would be walking, and I would read to him, and he would enter the toilet and I would read to him, and he would enter the house looking for something and I would read to him! End quote.
Siyar A’laam al-Nubala’, 13/251.
Al-Majd Ibn Taymiyah, the grandfather of Shaykh al-Islam Ibn Taymiyah.
When he went into the toilet, he would tell his son to read and raise his voice, so that he could make use of this time and not waste it without benefitting from it.
Quoted by Ibn al-Qayyim in Rawdat al-Muhibbeen, p. 65
And Allaah knows best.