Answer
Praise be to Allaah.
It is known that the jinn can see people, but people cannot see the jinn. Allaah says (interpretation of the meaning):
“Verily, he [Shaytaan] and Qabeeluhu (his soldiers from the jinn or his tribe) see you from where you cannot see them”
[al-A’raaf 7:27]
Because the shayaateen (devils) are evil, they like to frequent dirty places. Allaah says (interpretation of the meaning):
“Bad statements are for bad people (or bad women for bad men) and bad people for bad statements (or bad men for bad women). Good statements are for good people (or good women for good men) and good people for good statements (or good men for good women)…”
[al-Noor 24:26]
Hence the shayaateen frequent the places where humans relieve themselves, and they want to do them harm.
The Prophet (peace and blessings of Allaah be upon him) has told us what we should do so that Allaah will protect us from the evil of the shayaateen when we enter the toilet. That is that before entering the place, the Muslim should say, “Bismillaah, Allaahumma inni a’oodhu bika min al-khubthi wa’l-khabaa’ith (In the name of Allaah, O Allaah, I seek refuge with You from evil and from the male and female devils).”
Al-Tirmidhi (no. 606) narrated from ‘Ali ibn Abi Taalib (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “A screen will be placed between the eyes of the jinn and the ‘awrah of the sons of Adam when one of them enters the toilet, if he says ‘Bismillaah (in the name of Allaah).” (Classed as saheeh by al-Albaani in Saheeh al-Tirmidhi, 496).
Abu Dawood (6) and Ibn Maajah (296) narrated that the Prophet (peace and blessings of Allaah be upon him) said: “These toilets are visited (by jinn), so when any one of you goes to the toilet, let him say, ‘Allaahumma inni a’oodhu bika min al-khubthi wa’l-khabaa’ith (O Allaah, I seek refuge with You from evil and from the male and female devils).’” (Classed as saheeh by al-Albaani in Saheeh Ibn Maajah, 241).
The word hushoosh, translated here as toilets, refers to places where people relieve themselves, and it includes the “water closets” that are in people’s houses.
“Visited (by jinn)” means that they are frequented by the devils, with the intent to cause harm to people.
Khubth means evil and khabaa’ith means evil souls, namely the devils, both male and female. So one is seeking refuge with Allaah from evil and from those who do evil.
From ‘Awn al-Ma’bood.
If the Muslim says this du’aa’ before entering the toilet, Allaah will grant him refuge from the devils.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said:
The benefit of saying Bismillaah is that it conceals a person. The benefit of seeking refuge with Allaah is that one is turning to Allaah from evil and from the male and female devils, for this place is filthy (khabeeth) and a filthy place is the abode of those who are evil (khubatha’). So it is the abode ofthe devils. Thus it is appropriate if one wants to enter the toilet to say “A’oodhu Billaah min al-khubthi wa’l-khabaa’ith (I seek refuge with Allaah from evil and from the male and female devils)” so that he will not be harmed by evil or by the evil souls.
Al-Sharh al-Mumti’, 1/83.
And Allaah knows best.