Does the command of the Prophet (peace and blessings of Allah be upon him) mean that something is obligatory?
Question

Is everything that the Messenger of Allah (peace and blessings of Allah be upon him) enjoined upon us obligatory? If the answer is yes, then how can we reconcile between that and the hadith which says, “Whatever I forbid to you, avoid it, and whatever I enjoin upon you, do as much of it as you can”? If the answer is no, then why, for example, is growing the beard obligatory and not Sunnah?.
Praise be to Allah.Firstly: 
The commands that are narrated in Islam are of three types: 
1 – A command which is accompanied by evidence which indicates that what is meant is that it is obligatory, such as the verse in which Allah says (interpretation of the meaning): 
“And perform As-Salaah (Iqaamat-as-Salaah)” [al-Baqarah 2:43]
The definitive evidence from the Quran and Sunnah, and the consensus of the Muslims, indicates that the command to establish the five daily prayers means that it is obligatory. 
2 – A command which is accompanied by evidence that it is not obligatory, such as the hadith in Saheeh al-Bukhaari (1183) in which the Messenger (peace and blessings of Allah be upon him) said: “Pray before Maghrib,” and the third time he said: “for whoever wants to,” not wanting the people to take it as a Sunnah. 
The words “for whoever wants to” indicate that the command in the words “Pray before Maghrib” does not mean that it is obligatory. 
3 – A command which does not come with any indication as to whether it is obligatory or not. This is what the scholars call al-amr al-mutlaq (general commands). It is not accompanied by anything to suggest whether it is obligatory or otherwise. The ruling on such commands is that they are obligatory. 
Hence the scholars said: A command that is not accompanied by any indication is obligatory.  
This is the view of the majority of scholars from the four madhhabs. 
See: Sharh al-Kawkab al-Muneer, 3/39 
They quoted a great deal of evidence from the Quran and Sunnah to support this view. 
The evidence from the Quran includes the following: 
1- 
“It is not for a believer, man or woman, when Allah and His Messenger have decreed a matter that they should have any option in their decision. And whoever disobeys Allah and His Messenger, he has indeed strayed into a plain error”
[al-Ahzaab 33:36]
So Allah has decreed that His command and the command of His Messenger (peace and blessings of Allah be upon him) rule out any other option, which proves that it is obligatory. 
End quote from al-Mudhkirah by al-Shanqeeti, p. 191 
2- 
“And let those who oppose the Messenger’s (Muhammad’s) commandment (i.e. his Sunnah legal ways, orders, acts of worship, statements) (among the sects) beware, lest some Fitnah (disbelief, trials, afflictions, earthquakes, killing, overpowered by a tyrant) should befall them or a painful torment be inflicted on them”
[al-Noor 24:63]
Here, Allah warns those who go against the command of the Messenger (peace and blessings of Allah be upon him) of fitnah (trial or tribulation), namely deviation, or of a painful torment; such a warning is only issued to one who fails to do something that is obligatory. This indicates that the general command of the Messenger (peace and blessings of Allah be upon him) is obligatory. 
End quote from Sharh al-Waraqaat by al-Fawzaan, p. 59.  
Al-Qurtubi said: This verse is quoted as evidence by the fuqaha’ to show that the command means that a thing is obligatory. 
3-  
Another example of the evidence quoted is the verse in which Allah denounces Iblees for not prostrating to Adam when he was commanded to do so (interpretation of the meaning): 
“ ‘What prevented you (O Iblees) that you did not prostrate yourself, when I commanded you?’”
[al-A’raaf 7:12]
So He rebuked Iblees for going against the command. 
Al-Shanqeeti, p. 192 
4- 
“ ‘Have you then disobeyed my order?’”
[Ta-Ha 20:93]
And He says of the angels (interpretation of the meaning): 
“ [they] disobey not, (from executing) the Commands they receive from Allah, but do that which they are commanded”
[al-Tahreem 66:6]
This indicates that going against the command is disobedience or sin.
Al-Shanqeeti, p. 192 
5- 
“And when it is said to them: ‘Bow down yourself (in prayer)!’ They bow not down (offer not their prayers)”
[al-Mursalaat 77:48]
This is a criticism of them for not obeying the command to bow. This indicates that it is obligatory. 
End quote from al-Shanqeeti, p. 191 
As for the evidence from the Sunnah that the general command means that a thing is obligatory, there is a great deal of such evidence, including the following: 
1 – The story of Bareerah, when she was set free and she chose to annul her marriage to her husband, who was a slave. Her husband loved her, and he was walking behind her on the streets of Madeenah with tears flowing down his cheeks, pleading with her to come back to him, and she refused; the Prophet (peace and blessings of Allah be upon him) interceded for him and said to her – as is narrated by Abu Dawood (2231) – “O Bareerah, fear Allah, for he is your husband and the father of your child.” She said: “O Messenger of Allah, are you commanding me to do that?” He said, “No, I am just interceding.” She said: “I have no need of him.”
Classed as saheeh by al-Albaani in Saheeh Abi Dawood, 1952. 
It was also narrated by al-Bukhaari, with different wording. 
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: She said: “Are you commanding me?” because it is established among the Muslims that his command means that a thing is obligatory. 
Al-Fataawa, 1/317 
2- 
The Prophet (peace and blessings of Allah be upon him) said: “Were it not that it would be too difficult for my ummah, or for the people, I would have commanded them to use the siwaak at the time of every prayer.”
Narrated by al-Bukhaari, 887; Muslim, 252. 
Al-Haafiz said in al-Fath: this indicates that a command implies that a thing is obligatory in two ways: 
(i) It is shown not to be obligatory although it is recommended; if a command may be interpreted as a recommendation, the hadith would have not stated that this is not obligatory.
(ii) He described the command as being difficult for them, which would only be the case if a command was understood as meaning that it was obligatory, because there is no hardship in a thing that is encouraged but left as optional, because it is permissible not to do it.
End quote. 
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: If the command of Allah and His Messenger is general in meaning, that implies that it is obligatory. 
Secondly: 
There is no contradiction between this principle, that a command means a thing is obligatory, and the words of the Prophet (peace and blessings of Allah be upon him), “If I forbid you to do a thing, then avoid it, and if I command you to do a thing, then do as much of it as you can” (narrated by al-Bukhaari, 7288; Muslim, 1337), because all that we understand from this hadith is that following commands is dependent upon one's ability to carry them out. This is part of the mercy and perfection of Islam. This does not apply only to the commands of the Prophet (peace and blessings of Allah be upon him), rather the commands of Allah, may He be exalted, are also dependent upon one's ability to do them, as Allah says (interpretation of the meaning): 
“So keep your duty to Allah and fear Him as much as you can”
[al-Taghaabun 64:16] 
“Allah burdens not a person beyond his scope”
[al-Baqarah 2:286]
 Al-Nawawi (may Allah have mercy on him) said in Sharh Muslim: The words of the Prophet (peace and blessings of Allah be upon him), “If I command you to do a thing, then do as much of it as you can”, form one of the basic principles of Islam, and is an example of the conciseness of speech which was bestowed upon him (peace and blessings of Allah be upon him). This includes innumerable rulings, such as prayers of all kinds. If a person is unable to do some of the essential parts of the prayer or fulfil some of its conditions, he may do the rest. If he is unable to wash some of the parts that should be washed in wudoo’ or ghusl, he should wash what he can. If he finds water that is only enough to wudoo’ or wash off some impurity partially, he should do whatever he can, and so on. If he finds something to cover only part of his ‘awrah, or he learns some of al-Faatihah and not all of it, he should do whatever he can, and so on. This is well known in the books of fiqh. 
End quote. 
Allah says concerning Hajj, which is one of the pillars of Islam, and one of the greatest duties (interpretation of the meaning): 
“And Hajj (pilgrimage to Makkah) to the House (Ka‘bah) is a duty that mankind owes to Allah, those who can afford the expenses (for one’s conveyance, provision and residence)”
[Aal ‘Imraan 3:97]
Based on the above, the command of the Prophet (peace and blessings of Allah be upon him) to let the beard grow indicates that it is obligatory, because the basic principle concerning commands is that they are obligatory, and there is no evidence in this case to suggest otherwise. 
For more information on the issue of letting the beard grow, please see the answer to questions no. 1189, 8196 and 48960
And Allah knows best.