كتاب الحيض
3  
The Book of Menstruation
(21)
Chapter: At the beginning of Islam, intercourse did not necessitate ghusl unless semen was emitted, then that was abrogated and ghusl becomes obligatory for intercourse
(21)
باب إِنَّمَا الْمَاءُ مِنَ الْمَاءِ ‏
Sahih Muslim 346 a

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.
حَدَّثَنَا أَبُو الرَّبِيعِ الزَّهْرَانِيُّ، حَدَّثَنَا حَمَّادٌ، حَدَّثَنَا هِشَامُ بْنُ عُرْوَةَ، ح وَحَدَّثَنَا أَبُو كُرَيْبٍ، مُحَمَّدُ بْنُ الْعَلاَءِ - وَاللَّفْظُ لَهُ - حَدَّثَنَا أَبُو مُعَاوِيَةَ، حَدَّثَنَا هِشَامٌ، عَنْ أَبِيهِ، عَنْ أَبِي أَيُّوبَ، عَنْ أُبَىِّ بْنِ كَعْبٍ، قَالَ سَأَلْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم عَنِ الرَّجُلِ يُصِيبُ مِنَ الْمَرْأَةِ ثُمَّ يُكْسِلُ فَقَالَ ‏ "‏ يَغْسِلُ مَا أَصَابَهُ مِنَ الْمَرْأَةِ ثُمَّ يَتَوَضَّأُ وَيُصَلِّي ‏"‏ ‏.‏
Reference : Sahih Muslim 346a
In-book reference : Book 3, Hadith 101
USC-MSA web (English) reference : Book 3, Hadith 677
  (deprecated numbering scheme)