Is It Sunnah to Have Long Hair?
Question

I read that one of the Companions used to tie up his hair at the back of his head, then another Companion came along whilst the first one was praying, and undid his hair. Is it permissible for men to tie their hair at the back?
Praise be to Allah.Ruling on tying up long hair
The Hadith referred to in the question was narrated from `Abdullah ibn `Abbas (may Allah be pleased with him), who said that he saw `Abdullah ibn Al-Harith praying, and his hair was braided and tied up at the back (ponytail). He went and started to undo it. When he finished praying, he turned to Ibn `Abbas and said: What do you have to do with my hair? He said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “The likeness of this one is that of a man who prays with his hands tied.” (Narrated by Muslim, no. 492)
Al-Munawi (may Allah have mercy on him) said: 
“What is meant by “braided and tied up at the back” is that his hair was gathered together . “(The likeness of) one who prays with his hands tied” means: with his hands tied to his shoulders, which is not appropriate (i.e., it is makrooh), because if his hair was not loose it would not fall to the ground (when prostrating), so he would not be prostrating with all parts of his body, like the hands of the one whose hands are tied cannot touch the ground. Abu Shamah said: This is to be understood as referring to when the hair is gathered to the back of the head after being braided, as women do.” (Fayd Al-Qadir, 3/6)
It says in Al-Mawsu`ah Al-Fiqhiyyah (26/109-110): 
“The jurists unanimously agreed that it is disliked to tie the hair when praying. What is meant by tying the hair is to fasten the braid of hair around the head, as women do , or to gather the hair and tie it at the back of the head (ponytail). This is not appropriate, but if a person prays like that, his prayer is still valid. 
The reason for the prohibition on doing this is that the hair prostrates along with the person who is praying, hence in the Hadith he is likened to the one who prays when his hands are tied to his shoulders. 
The majority are of the view that this ruling that this should not be done applies to everyone who prays like this, whether he did that especially for the prayer or he was like that before he prayed, and he did it for another reason and prayed as he was for no reason. This is indicated by the general wording of the authentic Hadiths and it is the apparent meaning of the report narrated from the Companions. 
Malik said: “The ruling that this should not be done applies specifically to the one who did that in order to pray.”
Is it Sunnah to have long hair?
With regard to the ruling on letting the hair grow long and tying it at the back of the head, this has been discussed in detail in the answer to question no. 69822 , where we noted that Ibn `Abd Al-Barr (may Allah have mercy on him) stated that during his time, letting the hair grow long had become a characteristic of the foolish, and that people of knowledge and righteousness had turned away from this custom. This is what is well established among people in most of the Muslim countries. 
Shaykh Ibn `Uthaymin (may Allah have mercy on him) said: 
It is not part of the Sunnah to let the hair grow long, because the Prophet (blessings and peace of Allah be upon him) let his hair grow because the people of that time used to do that . Hence when he saw a boy who had shaved part of his head he said: “Shave all of it or leave all of it.” If it was the case that the hair should be left to grow long, he would have told the boy to leave it (and not shave any part of it). 
Based on that, we say: Letting hair grow long is not part of the Sunnah, but if people customarily do that, then do it, otherwise do what the people customarily do, because something may be Sunnah in a specific sense or it may be Sunnah in a general sense . For example, if there is nothing to render a garment or a “look” prohibited, then in this case the Sunnah is to follow what the people customarily do, because the Prophet (blessings and peace of Allah be upon him) did it because he was following the custom of the people. So now we say: The custom of people nowadays is not to let the hair grow long. Hence our senior scholars, the first of whom we will mention among the senior scholars is our Shaykh `Abd ar-Rahman ibn as-Sa`di, and our Shaykh `Abd Al-`Aziz ibn Baz, and other shaykhs such as Shaykh Muhammad ibn Ibrahim and his brothers, and other senior scholars, do not let the hair grow long. That is because they do not think that this is Sunnah, and we know that if they thought that this was Sunnah, they would have been the most eager of people to follow the Sunnah. So the correct view is that this matter is to be based on what people usually do. So if you are in a place where people usually let their hair grow long, then do it, otherwise do not do it.” (Liqa’at Al-Bab Al-Maftuh, no. 126, question no. 16) 
Based on that, reference should be made to what is customary among the people with regard to letting the hair grow long. In societies where the men do not let their hair grow long, one should not let it grow long, and tying it at the back of the head is even more reprehensible, because it is an imitation of women and immoral people. 
And Allah knows best.