عن أبي هريرة قال قال رسول الله صلى الله عليه و سلم إن الله لا ينظر إلى صوركم و أموالكم ولكن ينظر إلى قلوبكم و أعمالكم رواه مسلم
Abū Hurairah reports that the Messenger of Allāh (صلى الله عليه و سلم) said, “Indeed, Allāh does not look at your outward form nor your wealth, but He looks at your hearts and your actions.”
Mufti Taqi Uthmāni writes, “It seems to this weak slave that the meaning of this ḥadīth is that Allāh, Exalted is He, does not look at the strength of your bodies nor the beauty of your forms; He only looks at your inward and outward actions. By his statement ‘your heart’, he indicates to inner deeds, just as he indicates to outward deeds with his statement ‘your actions’.
The gist is that the one whose deeds were good, Allah, Exalted is He, would be pleased with them, even if they were emaciated and repulsive in appearance. Similarly, the one whose actions are bad, Allah, Exalted is He, would be displeased with them even though their bodies were strong and their appearance beautiful.
There is, thus, no room in this ḥadīth for the one who claims, like some heterodox individuals and uneducated mystics, that only purification of the heart is desired from humanity, and that [since] no consideration is given to their outward actions, they may do whatever they like.
This is because the texts of the Qur’ān and the Sunnah agree that humans are legally obligated to rectify their outward actions. The reality is that those actions which are apparent are only spoiled due to the corruption of the heart, and thus, those apparent actions are an indication of inner corruption.
Now, if a person is forgiven because of some hidden quality, that is something else altogether, but it doesn’t necessitate that no censure will befall their wrong actions. If there was no worth attributed to one’s actions, the Prophet (صلى الله عليه و سلم) would not have mentioned, ‘and your actions,’ right after his statement, ‘towards your heart’. However, he (صلى الله عليه و سلم) mentioned both things which proves that internal and external rectification are what is sought.
In a similar manner, it is quiet clear that the view of one who infers from this ḥadīth that Divine laws have no connection to the body and outward appearance [of an individual], and thus it is permissible for a person to select whatever method of adornment and beautification for their body (e.g. shaving the beard, lengthening the mustache, etc.) they wish, is quiet false. Really, this ḥadīth has no connection to this.
Indeed, that which Messenger (صلى الله عليه و سلم) ordered (e.g. growing the beard and trimming the mustache) are part of the visible actions that one is tasked with, and which, without a doubt, are part of the Divine law which Allāh, Exalted is He, has obligated us with.
Rather, what is meant by negating regard for bodies and outward appearances is that beauty and ugliness do not bring about the pleasure or displeasure of Allāh; consideration is only given to the actions one performs.
Furthermore, it is authentically reported from the Prophet (صلى الله عليه و سلم) that he forbade many actions connected to one’s body, like his command to lengthen the beard, trim the mustache, and clip the nails, or his cursing the one who tattoos, the one who gets tattooed, those who plucks other’s eyebrows, the one who orders that it be done, and the one who puts gaps in the teeth, so how could it be said that these laws are outside of the laws of Allāh, Exalted is He?” (Takmilah Faṭḥ al-Mulhim. Dār Iḥyā al-Turāth al-cArabī. 5:287-282)