Illegal sexual intercourse is called ‘Zina’ in Arabic. The word Zina is usually used for illegal sexual intercourse but there are also other types of Zina. In brief they are: touching Na-Mehram, talking unnecessarily to Na-Mehram, glancing Na-Mehram, or any unnecessary connection with any Na-Mehram man or woman. Indeed it is a shameful act. Sexual intercourse is allowed between (husband & wife) only.

Punishment For Married Adulterer
If a married person commits Zina then he/she should be stoned to death. There is no forgiveness for them in this world. They should bear this punishment and should beg Allah for His mercy and forgiveness. The punishment for married people is stricter because they are already married and can fulfill their sexual desires with their spouse.

The Holy Quran
The woman and the man guilty of illegal sexual intercourse, flog each of them with a hundred stripes. Let not pity withhold you in their case, in a punishment prescribed by Allah, if you believe in Allah and the Last Day. And let a party of the believers witness their punishment. (This punishment is for unmarried persons guilty of the above crime but if married persons commit it, the punishment is to stone them to death, according to Allah’s Law). [Chapter #24 Surah An-Noor, Verse #2]

Hadith
Narrated Jabir: A man from the tribe of Bani Aslam came to Prophet Mohammad (SalAllaho Alaihi Wasallam) while he was in the mosque and said, “I have committed illegal sexual intercourse.” The Prophet turned his face to the other side. The man turned towards the side towards which the Prophet had turned his face, and gave four witnesses against himself. On that the Prophet called him and said, “Are you insane?” (He added), “Are you married?” The man said, ‘Yes.” On that the Prophet ordered him to be stoned to the death in the Musalla (a praying place). When the stones hit him with their sharp edges and he fled, but he was caught at Al-Harra and then killed. [Sahi Bukhari (Book #63, Hadith #195)]

Hadith
Narrated Zaid bin Khalid and Abu Huraira: The Prophet (SalAllaho Alaihi Wasallam) said, “O Unais! Go to the wife of this (man) and if she confesses (that she has committed illegal sexual intercourse), then stone her to death.” [Sahi Bukhari (Book #38, Hadith #508)]

Punishment For Unmarried Adulterer
If an unmarried person commits Zina then he/she should be scourged 100 (one hundred) lashes and sent into exile for 1 (one) year. The punishment for unmarried people is lighter as they do not have a spouse to whom they can go to fulfill their sexual desires, that’s why they are given a lighter punishment.

Hadith

Narrated Zaid bin Khalid: Allah’s Apostle (SalAllaho Alaihi Wasallam) ordered that an unmarried man who committed illegal sexual intercourse be scourged one hundred lashes and sent into exile for one year. [Sahi Bukhari (Book #48, Hadith #817)]

Punishment In Torah (Pentateuch)
Torah (Pentateuch) revealed over Prophet Moses (Alaihissalaam), has also the same punishment for Zina as the Quran has told us.