Read the article ‘Kamma Changes Love Into Spite‘ that is based on this short animated story.
He engages in sexual misconduct. He has sexual relations with women who are protected by their mother, father, mother and father, brother, sister, or relatives; who are protected by their Dhamma; who have a husband; whose violation entails a penalty; or even with one already engaged.
Paṭhamasañcetanika Sutta – AN 10.217
This is also true for women who partake in any sexual activity with any man who is not their husband. Therefore, understand and abstain from engaging in sexual misconduct, this is the 3rd precept, taught by the compassionate Buddha for beings to avoid such suffering.
Remember, the gratification felt is little, momentary and negligible when compared to the immense suffering caused by engaging in sexual misconduct, therefore be wise.