Answered by Shaykh Faraz Rabbani
Is it required to cover your head when entering the bathroom or while using the toilet?
Walaikum assalam wa rahmatullah,
It is not obligatory. However, it is recommended, as it is established from the practice of the Beloved of Allah (Allah bless him and give him peace). [Ibn Abidin, Radd al-Muhtar from Siraj al-Din Ghaznawi]