At the beginning of Islam, intercourse did not necessitate ghusl unless semen was emitted, then that was abrogated and ghusl becomes obligatory for intercourse Sahih Muslim 346 a

Arabic hadith text
حَدَّثَنَا أَبُو الرَّبِيعِ الزَّهْرَانِيُّ، حَدَّثَنَا حَمَّادٌ، حَدَّثَنَا هِشَامُ بْنُ عُرْوَةَ، ح وَحَدَّثَنَا أَبُو كُرَيْبٍ، مُحَمَّدُ بْنُ الْعَلاَءِ - وَاللَّفْظُ لَهُ - حَدَّثَنَا أَبُو مُعَاوِيَةَ، حَدَّثَنَا هِشَامٌ، عَنْ أَبِيهِ، عَنْ أَبِي أَيُّوبَ، عَنْ أُبَىِّ بْنِ كَعْبٍ، قَالَ سَأَلْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم عَنِ الرَّجُلِ يُصِيبُ مِنَ الْمَرْأَةِ ثُمَّ يُكْسِلُ فَقَالَ ‏"‏يَغْسِلُ مَا أَصَابَهُ مِنَ الْمَرْأَةِ ثُمَّ يَتَوَضَّأُ وَيُصَلِّي ‏"
Translation
Ubayy Ibn Ka'b reported

I arked the Messenger of Allah (ﷺ) about a man who has sexual intercourse with his wife, but leaves her before orgasm. Upon this he (the Holy Prophet) said: He should wash the secretion of his wife, and then perform ablution and ofier prayer.