On the authority of Abû Masûd Uqbah bin ‘Âmir al-Ansâri [radî Allâhu ‘anhu] who said: “The Messenger of Allâh [sall-Allâhu ‘alayhi wa sallam] said: ‘From the words of the previous prophets that the people still find are: If you feel no shame, then do as you wish’.” [Al-Bukhârî]
This portion of the hadîth [i.e. “If you feel no shame, then do as you wish.”] is in the form of an imperative or command. For that reason, it has been interpreted in a number of different ways. Each interpretation shall be discussed separately.
The First Interpretation
Some scholars say that although this phrase is in the form of an imperative, it is actually not meant to be an order. Instead, it is a form of threat or warning. Its meaning is, in other words: “If you have no shame or modesty, then do whatever you wish and Allâh will recompense you – punish you – for what you do.”
This is a known form of speech in Arabic. This style can also be found in the Qur’ân for example, Allâh says,
“Do what you will. Verily, He is All-Seer of what you do.” [Fussilat 41:40]
This is not a command for one to do as one likes, but. instead, it is a type of threat. In fact, in their translation of the Qur’ân, al-Hilâlî and Khan add in parenthesis at the end of that verse: “…this is a severe threat to the unbelievers.” 
Ibn Rajab states that a number of scholars follow this interpretation.  Al-Munâwi , and Al-Bugha and Mistu  conclude that this is the strongest interpretation.
A Second Interpretation
A second interpretation for this hadîth also states that the imperative or command is not what is meant by this statement. Instead, it is a case of an order being used as a statement of fact. In other words, the meaning is: “If a person does not have any shame, then he does whatever he wishes.” Hayâ’ [shame or modesty] is one of the most important factors that keeps a person away from committing a lewd or sinful act. If a person has no feeling of shame or modesty, then there is nothing to prevent him from doing almost anything. He would do almost anything because he has nothing inside of him telling him that such is not good behaviour and that he should be ashamed to act in that fashion.
Ibn Qayyim has shed some more light on this interpretation by saying that when a person commits sins, his feeling of hayâ’ is lessened. As he commits more and more sins, his hayâ’ is weakened more and more, to the point that it may not exist at all. When he gets to that point, he does not care what people might say or think about him. In fact, he might even start to tell others about the sins that he has committed. This type of person will not be forgiven and the road to repentance will be blocked for him. The Prophet [sall-Allâhu ‘alayhi wa sallam] has said:
“All of my Nation are apt to be forgiven except for those who commit sins openly. Included among those who commit sins openly is where a person performs a deed during the night and, although Allâh had concealed that sin, in the morning he says: ‘0 so and so, last night I did such and such.’ He spent the night being concealed by Allâh and in the morning he uncovered Allâh’s concealment from himself.” [Al-Bukhârî] 
This interpretation is also consistent with what is known in the Arabic language. Another example of this nature, according to some, is the hadîth:
“Whoever falsely attributes something to me must take his own seat in the Fire.”  The meaning of this hadîth is a statement of fact: “The one who falsely attributes something to me shall take his own seat in the Fire.”
Al-Khattâbi explains why the Prophet [sall-Allâhu ‘alayhi wa sallam] made this statement in the form of a command rather than a statement of fact. He says that the character that keeps a person from committing a sin is hayâ’ or shame. If a person has no shame, then he becomes like someone who is naturally ordered by his soul to commit evil.  Hence, it is proper to state the meaning in the form of an order as, in the long-run; this is what it is actually describing.
According to Ibn Rajab, this interpretation of this hadîth has been favoured by Abu Ubayd, al-Qâsim bin Salâm, Ibn Qutaybah, Muhammad bin Nasr al-Marûzi and others. He also states that Abû Dâwûd has narrated from Ahmad a quote that indicates that he also follows this interpretation. 
A Third Interpretation
A third interpretation is that the command here is in the form of displaying permission.  In other words: “If you are contemplating an act and it is an act such that there is no reason to be ashamed of it in front of Allâh or the people, then you may do that act.” Hence, according to this interpretation, modesty or shame becomes the standard over whether or not on should do the act. If there is nothing to be ashamed of concerning the act, then there is no harm in doing the act. However, if there is reason to be ashamed from that act, either with respect to Allâh or others, then the person should not perform that act.
This is the interpretation that is favoured by an-Nawawî.  This view has also been recorded from Ahmad.
The interpretation of a command to mean permission is also well-known and established in Arabic. In fact, numerous examples of this nature may be found in the Qur’ân. For example, Allâh says:
“Then when the [Friday] prayer is ended, disperse through the land and seek the bounty of Allâh.” [Al-Jumu’ah 62:10]
This verse is actually an imperative. However, its meaning is permissibility:” After the prayer, you may disperse through the land…”
A Fourth Interpretation
Salîm al-Hilâlî offers a fourth interpretation. He states, as a possible understanding, that this hadîth is a form of encouragement to have the characteristic of modesty and indirectly points to the virtues of modesty. In this way, the hadîth is understood to say: “Since it is not allowed to do any act you wish, it is not allowed to leave having modesty and shame.”
By Jamâl ad-Dîn M. Zarabozo
Commentary on the Forty Hadîth of Imâm an-Nawawî, Vol. 2, Pgs. 802-805
1. Al-Hilâlî and Khan, P. 866
2. Ibn Rajab, Jâmi’, Vol. 1, P. 498
3. Al-Munâwi, Vol. 2, P. 540
4. Al-Bugha and Mistu, P. 140
5. Muhammad bin Qayyim, Al-Jawâb al-Kâfi liman Sa’ala Anal-Dawâl-Shâfi’i [Beirut: Dâr al-Kutub al-Ilmiyyah, 1983], P. 78-79
6. Recorded by al-Bukhârî, Muslim and many others. Al-Hilâlî points out that it is mutawâtir. See al-Hilâlî, Eeqâdb, P. 304
7. Ibn Hajr, Fath [Maktabah Dar al-Bâz], Vol. 10, P. 641. Al-Zamakhshari also stated something similar. See al-Munâwi, Vol. 2, P. 540
8. Ibn Rajab, Vol. 1, P. 498
9. If a sentence is stated in the form of the imperative, it has many possible meanings. The first meaning is that of obligation. This is its understood meaning unless there is evidence to demonstrate otherwise. However, it could also imply recommendation or permissibility. It can also be interpreted in the manner described earlier as a warning or censure. For more on this point, see Muhammad Hashim Kamali, Principles of Islamic Jurisprudence [Selangor. Malaysia: Pelanduk Publications, 1989], Pgs. 177-179
10. Ibn Hajr, Path [Maktabah al-Bâz] Vol. 10, P 641
11. Ibn Rajab, Jâmi’, Vol. 1, P 503
12. Salîm al-Hilâlî, Al-Hayâ’ fi Dhau al-Qur’ân al-Karîm wâl-Ahadeethal-Saheehah [Dammam, Saudi Arabia: Maktabah bin al-Jawzi, 1988), P. 10. Al-Hilâlî did not state who favours this fourth interpretation. Al-Jîlâni also mentions it in passing. [See Fadhlullâh al-Jîlâni, Fadhl Allâhu as-Samad fi Tawdhîh al-Adab al-Mufrad [Cairo: al-Maktabah as-Salafiyyah, 1407 AH], Vol. 2, P. 54]. Al-Hilâlî concludes that all four interpretations are good and offer excellent meanings. However, he favours the interpretation that the sentence is a command expressing a fact. Ibn Rajab actually mentions a fifth interpretation, but he states that it is not at all feasible. See Ibn Rajab, Vol. 1, Pgs. 504-505