Why does Islam Impose Harsh Punishments for Sex outside Marriage

Punishment in Islam has a social purpose, which is to dissuade others from committing the same crime. The nature of the punishment depends on the seriousness of the crime in question. Nowadays, some are opposed to the Islamic punishment for fornication and adultery because they see it as disproportionate or too harsh a punishment. The basic problem here is the different standards by which the severity of the crime is measured.
Islam views adultery as a very serious crime, because it undermines the very foundation of the family system upon which the whole superstructure of the society is built. Illicit relationships destabilize the family and bring about the breakdown of the system. Family breakdown imperils the physical and mental health of future generations, which in turn leads to a vicious circle of decadence, dissipation, and dissolution. Therefore, it is imperative that all measures must be taken to protect the family. That is why Islam emphasizes protection of the family by imposing severe punishments for activities that threaten the family foundation. These punishments are the same for men and women alike.
There is no overstating of the fact that Islamic punishments are only a part of a vastly larger integrated whole. There are essential conditions for the application of prescribed punishments in Islam:

First

First, Muslims are strongly encouraged to marry whenever possible, providing a lawful means of gratification. Imam Ali (a.s.) exhorts,

“Marry, because marriage is the tradition of Holy Prophet Muhammad (s.a.w.).”

Holy Prophet Muhammad (s.a.w.) also said,

“Whosoever likes to follow my tradition, then he should know that marriage is from my tradition.”[1]

A man may legally take as many as four wives as long as he treats each of them equitably and justly. In cases of confirmed incompatibility or dissatisfaction, a wife has the right to request the dissolution of the marriage.

Second

Second, Muslims, whether married or unmarried, must adhere to proper dress and behavior guidelines at all times. Privacy is to be respected and compromising situations strictly avoided as a matter of obedience to Allah.

Third

Third, only a legitimate Islamic government has the right to implement these punishments. Such an Islamic government must establish justice as its core value in all affairs so that the social and cultural environment of the country is congenial for the moral life of its citizens. It is only after the above two conditions have been fulfilled that a government is entitled to implement Islamic punishments on its land, and only then does the court gain the authority to judge a case according to its provisions.
And finally, any case that comes before the court for judgment must be investigated thoroughly and proper evidence brought before the court to satisfy all the requirements of Islamic law. Conviction is subject to strict conditions, which are most difficult to fulfill. This means that, in reality, the punishments are seldom carried out without the connivance of the criminal, and serve primarily as deterrents.

[1] «تَزَوَّجُوا، فَاِنَّ التَّزْوِيجَ سُنَّهُ رَسُولِ اللهِ (صلي الله عليه و آله وسلم)، فَاِنَّهُ كَانَ يَقُولُ: مَنْ كَانَ يُحِبُّ اَنْ يَتَّبِعَ سُنَّتِي، فَاِنَّ مِنْ سُنَّتِي اَلتَّزْويِجَ۲»
وسایل الشیعه 4