And the two1 who commit it [i.e., unlawful sexual intercourse] among you - punish [i.e., dishonor] them both. But if they repent and correct themselves, leave them alone. Indeed, Allāh is ever Accepting of Repentance and Merciful.
Translation: Saheeh International (English)
1 Scholars differ over whether "the two" refers to two of the same sex (i.e., homosexuals) or those of opposite sexes. In either case, later rulings outlined in the sunnah have replaced this one.
If two of your men commit a sexual offence – whether they are married or unmarried – punish them with words and blows, humiliating and disciplining them. If they turn away from what they were doing and correct themselves, then do not harm them. Those who turn away from a sin and ask for forgiveness are like those who have not sinned. Allah turns to those who repent to Him asking for forgiveness, and is Compassionate with them. The ruling of this verse was replaced with the ruling that unmarried men who have illicit sexual relations should be whipped a hundred times and banished for a year, and married men who have illicit sexual relations should be stoned.