All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Both whistling and unnecessary talking while one is relieving himself in the toilet is disliked. When the two matters are done together, this is even more disliked. The Hanbali scholar Ibn Muflih quoted Shaykh ‘Abdul-Qadir as saying: "Whistling and handclapping are disliked." Allaah Almighty dispraised the polytheists, saying (what means): {And their prayer at the House was not except whistling and handclapping.} [Quran 8: 35] The verse is interpreted as such by Abu Bakr ibn Al-‘Arabi and it was related from Ibn ‘Abbaas, Ibn ‘Umar, Al-Hasan, Mujaahid, ‘Atiyyah, Qatadah, As-Suddi and others .
An-Nawawi said: "The scholars unanimously agree that talking while one is relieving oneself is disliked…All types of talking in such a situation are disliked unless there is a necessity."
Abu Sa‘eed Al-Khudri narrated that the Messenger of Allaah, sallallaahu ‘alayhi wa sallam, said: "When two persons go together for the purpose of relieving themselves uncovering their private parts and talking together, Allaah, the Exalted, gets wrathful at this (action)." [Abu Daawood and Ahmad; An-Nawawi: good]
Allaah Knows best.