Is it Sunnah to cover the head when going to the toilet?
Question

Is there any report in the Sunnah about it being obligatory to cover the head when going to the toilet, for women or men?
Praise be to Allah.Firstly: 
It was narrated by al-Bayhaqi in his Sunan (464) and Abu Nu‘aym in al-Hilyah (2/182) that ‘Aa’ishah said: When the Prophet (blessings and peace of Allah be upon him) went to the toilet, he would cover his head, and when he was intimate with his wife he would cover his head.
Its isnaad is da‘eef. See: ad-Da‘eefah (4192) 
Al-Bayhaqi (465) narrated that Habeeb ibn Saalih said: When the Messenger of Allah (blessings and peace of Allah be upon him) went to the toilet, he would put on his shoes and cover his head. 
This is mursal. It was classed as da‘eef by Shaykh al-Albaani in Da‘eef al-Jaami‘ (4393). 
There is no saheeh report from the Prophet (blessings and peace of Allah be upon him) about this topic at all. 
Secondly: 
It was proven that this was a practice of some of the early generation. 
It was narrated from Ibn ‘Urwah, from his father, that Abu Bakr as-Siddeeq said, when he was addressing the people: O Muslims, feel shy before Allah, for by the One in Whose Hand is my soul, I keep my head covered when I go to relieve myself in the open, out of shyness before my Lord. 
Narrated by Ibn al-Mubaarak in az-Zuhd (1/107); Ibn Abi Shaybah in al-Musannaf (1/105). Its isnaad is saheeh. 
See: al-‘Ilal by ad-Daaraqutni (1/186) 
Al-Bayhaqi (may Allah have mercy on him) said in as-Sunan (1/96): 
With regard to covering the head when going to the toilet, there was a report narrated from Abu Bakr as-Siddeeq, and it is soundly narrated from him. 
Ibn Abi Shaybah said (1/106): Ibn ‘Uyaynah told us, from Ibn Tawoos who said: My father instructed me, when I went to the toilet, to cover my head. I said: Why did he instruct you to do that? He said: I do not know. 
Thirdly: 
Some of the fuqaha’ are of the view that covering the head is part of good manners and is something recommended (mustahabb). 
An-Nawawi (may Allah have mercy on him) said in al-Majmoo‘ (2/93): 
Imam al-Haramayn, al-Ghazaali, al-Baghawi and others said: It is recommended not to enter the toilet bare-headed. End quote. 
Al-Mirdaawi (may Allah have mercy on him) said in al-Insaaf (1/97): 
It is mustahabb to cover the head when going to the toilet. This was mentioned by a number of our companions. End quote. 
It says in al-Mawsoo‘ah al-Fiqhiyyah (22/5): 
It is recommended not to enter the toilet with the head uncovered, because of a report which says that when the Prophet (blessings and peace of Allah be upon him) entered the toilet, he would put on his shoes and cover his head. End quote. 
Ibn ‘Uthaymeen (may Allah have mercy on him) was asked about the ruling on entering the bathroom with the head uncovered. 
He replied:
There is nothing wrong with entering the bathroom with the head uncovered, but the fuqaha’ regarded it as mustahabb to cover the head when entering the toilet.
End quote from Majmoo‘ Fataawa wa Rasaa’il Ibn ‘Uthaymeen (11/68). 
It may be said, and Allah knows best, that this comes under the heading of good manners and good conduct when relieving oneself in a place that is open, but not in places where one is screened, as in the case of toilets and washrooms nowadays. 
Whatever the case: 
The matter is as stated above: there is no saheeh hadith from the Prophet (blessings and peace of Allah be upon him). Those of the early generations who did that only did it because of a strong degree of modesty and self-concealment in this situation. 
Something similar was narrated by Ibn Abi Shaybah (1/106) with a saheeh isnaad from Abu Moosa, who said: I do ghusl in a dark room, and I turn my back when I take off my clothes, out of shyness before my Lord. 
If anyone does that, following the example of those among the early generations who did it, then it is good manners and praiseworthy, in sha Allah, so long as he keeps in mind the attitude mentioned above, namely great shyness before Allah, may He be glorified and exalted, and observing proper etiquette before Him. 
But if a person does not do that, there is no blame on him and he is not doing anything makrooh, in sha Allah. 
With regard to the view that it is obligatory to cover the head when going to the toilet, none of the Muslim scholars said that as far as we know. 
For more information on the etiquette of relieving oneself, please see the answer to question no. 2532
And Allah knows best.