As stated in Bhagavad-gita (BG 7.11), sex life not contrary to the principles of religion is sanctioned by Krsna. Because Sarmistha, the daughter of a king, had begged Yayati for a son, their combination was not lust but an act of religion
SB Canto 9
When Princess Śarmiṣṭhā begged King Yayāti for a son, the King was certainly aware of the principles of religion, and therefore he agreed to fulfill her desire. Although he remembered the warning of Śukrācārya, he thought of this union as the desire of the Supreme, and thus he had sex with Śarmiṣṭhā.
King Yayāti was completely aware of the duty of a kṣatriya. When a kṣatriya is approached by a woman, he cannot deny her. This is a religious principle. Consequently, when Dharmarāja, Yudhiṣṭhira, saw Arjuna unhappy after Arjuna returned from Dvārakā, he asked whether Arjuna had refused a woman who had begged for a son. Although Mahārāja Yayāti remembered Śukrācārya's warning, he could not refuse Śarmiṣṭhā. He thought it wise to give her a son, and thus he had sexual intercourse with her after her menstrual period. This kind of lust is not against religious principles. As stated in Bhagavad-gītā (BG 7.11), dharmāviruddho bhūteṣu kāmo 'smi: sex life not contrary to the principles of religion is sanctioned by Kṛṣṇa. Because Śarmiṣṭhā, the daughter of a king, had begged Yayāti for a son, their combination was not lust but an act of religion.