Narrated Abu Rafi: Saeed ibn Abu Saeed al-Maqburi reported on the authority of his father that he saw Abu Rafi the freed slave of the Prophet ﷺ, passing by Hasan ibn Ali (Allah be pleased with them) when he was standing offering his prayer. He had tied the back knot of his hair. Abu Rafi untied it. Hasan turned to him with anger, Abu Rafi said to him: Concentrate on your prayer and do not be angry: I heard the Messenger of Allah ﷺ say: This is the seat of the devil, referring to the back knot of the hair.
Hadith Referenceسنن ابي داود / كتاب الصلاة / 646
Hadith Gradingالألبانی:حسن | زبیر علی زئی:إسناده حسن
Hadith Takhrij« سنن الترمذی/الصلاة 170 (384)، (تحفة الأشراف: 12030)، وقد أخرجہ: سنن ابن ماجہ/إقامةالصلاة 167 (1042)، مسند احمد (6/8، 391)، سنن الدارمی/الصلاة 105 (1420) (حسن) »
´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.'"
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