In the Qur'an, there is a concept called zina (زنا), which refers to both fornication and adultery.
In the early days of Islam, the punishment for zina was confinement to the house or corporal punishment. The woman would be confined to the house until she died or another piece of legislation came into force. The man would receive corporal punishment.
And those of your women, who commit illegal sexual intercourse, take
the evidence of four witnesses from amongst you against them; and if
they testify, confine them (i.e. women) to houses until death comes to
them or Allah ordains for them some (other) way. And the two persons
(man and woman) among you, who commit illegal sexual intercourse, hurt
them both. (Qur’an 4:15–16)
The fornicatress and fornicator, 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. (Qur’an 24:2)
The verses are for married and unmarried persons who commit zina. However, there may be a distinction between the married state of the offender of zina in that the married person will get a heftier punishment than the unmarried counterpart, because there is no legitimate reason why the married person cannot have sex within marriage. Therefore, the unmarried person may receive a lighter sentence or at most receive some lashings whereas the married person is stoned to death.
Source: Abdulmajeed Hassan Bello (2011) The punishment for adultery in Islamic
law and its application in Nigeria, Journal of Islamic Law and Culture, 13:2-3, 166-182, DOI:
10.1080/1528817X.2012.733132