In order to establish an Islamic Society and close the doors to lewdness, it is necessary to stop people doing this. Punishment is a deterrent to helping this end and punishment is also dependent upon your background. Those who had been abused by their masters and used as slaves who then commit adultery are only given fifty lashes, while those who were in positions of honour and dignity would get double the punishment;-
Surah 4 verses 25-28
4:25 (As the Qur’an is being revealed to you O Messenger, the emancipation of the slaves, male and female, is steadily taking place.) A man among you who cannot find a free believing woman willing to marry him, should have no hesitation in asking the hand of a believing maiden from her guardian. God knows your beliefs and reiterates that all human beings are equal in the Sight of God (17:70). Pay them a generous marital gift in kindness. They shall maintain moral behaviour, by not committing adultery, or having secret relations. Since their upbringing has been deficient in the environment of slavery, their punishment will be half that of the free women, if they commit indecency after marriage. The permission to marry a bonded woman is for him who fears he might commit sin. The better recourse is freeing her first from bondage. Men and women must be patient and exercise self-control while waiting to get married. God is Forgiving, Merciful.
4:26 God will explain to you and guide you by the examples of those who were before you, and turn to you (in Mercy). And God is Knower, Wise.
4:27 God turns to you in kindness, while those who follow their desires want that you drift far away from the right path. [They would rather have no laws to constrain their desires]
4:28 God wishes to lighten your burden with His Guidance. The human being is created weak, having the tendency to fall victim to his own selfish desire [7:17, 25:28-29]
33:30 O Wives of the Prophet! (You will be seen as role models for other women, therefore), if any of you displays unseemly conduct, double would be her suffering, for indeed, that is easy for God.
Before the system was set up, before the slaves were completely eliminated, or when they had been free but not fully educated in the new norms of the Islamic Society, they still had punishments applied to them, although to a lesser degree.
Hence, the death sentence to murderers is still required, however along the road to the Straight Path we are on [or completely off it], by all means with some sort of dignity.