In the answers to questions no. 96280 and 163428 we stated that it is makrooh for a man to pray with his hair tucked up, which means that he gathers his hair together and ties it back, thus preventing it from prostrating with him. The prohibition in this case means that it is disliked according to the opinion of the majority of scholars; it does not mean that it is haraam or prohibited in the sense understood by the questioner. It says in al-Mawsooah al-Fiqhiyyah (26/109): The fuqaha' are unanimously agreed that it is makrooh to tie back the hair when praying. What is meant by tying back is wrapping the braid around the head as women do, or gathering the hair and tying it at the back of the head. This is makrooh but if a person prays like that, his prayer is still valid. End quote.
An-Nawawi (may Allah have mercy on him) said:
The scholars are unanimously agreed that it is not permissible to pray with one's sleeves or garment rolled up and the like, or with one's hair braided or with one's hair wrapped up beneath the turban and so on. All of that is not permissible according to the consensus of the scholars, and it is makrooh in the sense of being discouraged and not proper. If a person prays like that, he has done something wrong but his prayer is valid. End quote. Sharh Muslim, 209.
This ruling applies only to men, not women, because when praying the woman is commanded to cover herself and if we were to tell the woman to undo her hair when praying or let her braids prostrate with her, as we tell men to do, that might lead to it (her hair) becoming uncovered whilst praying, and it is not permissible to uncover it because it is awrah. But the hair of a man is not awrah, as is quite obvious.
Al-Ghazaali (may Allah have mercy on him) said:
A man should not pray with his hair tied back. This prohibition applies only to men.
End quote from Ihya' Uloom ad-Deen, 1/156
Ash-Shawkaani (may Allah have mercy on him) said:
Al-Iraqi said: This applies only to men, not women, because women's hair is awrah and must be covered when praying; if a woman were to leave her hair undone, it might come loose and become difficult to cover, which would render her prayer invalid.
Moreover, it is difficult for a woman to undo her hair for the prayer, and we know that the Prophet (blessings and peace of Allah be upon him) granted them a concession allowing them not to undo their braids when doing ghusl, even though there is a need to make all of the hair wet, as stated above.
End quote from Nayl al-Awtaar, 2/393
It says in Asna'l-Mataalib, 1/163:
Az-Zarkashi said: We should note that this issue (tying back the hair when praying) applies only to men. With regard to women, the command to undo the braid causes hardship and is contrary to beautification. End quote.
Based on that, there is nothing wrong with a woman tucking her hair or tying it back when she is praying; she is not required to undo her braids.
And Allah knows best.
Reproduced from Islam QA