Praise be to Allah.
This hadith was narrated by al-Bukhari (4802) and Muslim (1466) from Abu Hurayrah (may Allah be pleased with him) from the Prophet (peace and blessings of Allah be upon him) who said: “A woman may be married for four things: her wealth, her lineage, her beauty and her religious commitment. Seek the one who is religiously-committed, may your hands be rubbed with dust (i.e., may you prosper).”
There is nothing in this hadith to suggest that it is enjoined or encouraged to marry a woman for her beauty, lineage or wealth. Rather what it means is that these are things that people look for in marriage. Some look for a wife who is beautiful, some look for a wife who is descended from a noble family, some look for a wealthy wife, and some look for a wife who is religiously-committed – and this last is what the Prophet (peace and blessings of Allah be upon him) encouraged when he said: “Seek the one who is religiously-committed, may your hands be rubbed with dust (i.e., may you prosper).”
Al-Nawawi (may Allah have mercy on him) said in Sharh Muslim:
The correct view concerning the meaning of this hadith is that the Prophet (peace and blessings of Allah be upon him) spoke of what people usually do, for they seek these four characteristics, the last of which in their view is religious commitment, but you who are seeking to follow the right way should seek the one who is religiously committed. This is not a command to do so… This hadith encourages us to seek the company of religiously-committed people in all things, because the one who keeps company with them will benefit from their good attitude and good ways, and will be safe from any bad influence from them.
Al-Mubaarakfoori said in Tuhfat al-Ahwadhi:
Al-Qaadi (may Allah have mercy on him) said: It is the people’s custom to seek certain characteristics in women and to choose a wife for a certain quality. It befits those who are religiously-committed to base their actions on religious guidance, especially with regard to matters that are serious and have lasting effects.
The scholars differed greatly as to the meaning of the words, “May your hands be rubbed with dust.” Al-Nawawi (may Allah have mercy on him) said in Sharh Saheeh Muslim:
The most correct view is that of the muhaqqiqeen, that this is a phrase which originally ‘May you become poor’, but the Arabs customarily used it in a sense other than its original meaning, so they would say things such as, ‘May your hands be rubbed in the dust,’ ‘May Allah kill him, how brave he is!’, ‘May he have no mother,’ ‘May you have no father,’ ‘May his mother be bereft of him,’ ‘Woe to his mother,’ and so on which they would say in the context of denouncing, rebuking, criticizing, expressing outrage encouraging an action, or expressing admiration, and so on.
And Allah knows best.