´Abu Rafi narrated that :` He passed by Al-Hasan bin Ali while he was performing Salat and he had gathered his locks at the back of his head, so he (Abu Rafi) undid them, and Al-Hasan turned to him angrily. He said: "Resume your Salat and do not be angry, for indeed I heard Allah's Messenger (S) saying: 'That is the seat of Ash-Shaitan.'"
1؎: But this is for men; for women, there is no harm in performing prayer with their hair braided. The Prophet sallallahu alayhi wa sallam even exempted women from untying their braids during the ritual bath (ghusl) for major impurity (janabah). If a woman were to untie her braid during prayer, her hair could come out from under her head covering, and if a woman's hair comes out from under her head covering during prayer, her prayer becomes invalid. Moreover, untying the braid at every prayer time and tying it again after prayer would also be troublesome.
Explanation & Benefits
Shaykh Dr. Abdur Rahman Freywai
1: But this is for men; there is no harm for women in performing prayer with their hair tied in a braid. The Prophet sallallahu alayhi wa sallam even exempted women from undoing their braids during the ritual bath (ghusl) for major impurity. If a woman were to untie her braid during prayer, her hair might come out from under her head covering, and if a woman's hair comes out from under her head covering during prayer, the prayer becomes invalid. Moreover, untying the braid at every prayer time and tying it again after prayer would also be troublesome.
Source: Sunan al-Tirmidhi – Majlis ‘Ilmi Dar al-Da‘wah, New Delhi Edition, Page: 384