Sahl bin Rafi' bin Khadij (may Allah have mercy on him) narrates from his father (Sayyiduna Rafi' bin Khadij (may Allah be pleased with him)) that the Messenger of Allah (peace and blessings be upon him) passed by him and called out to him. He came out to him (peace and blessings be upon him) and walked with him (peace and blessings be upon him) until they reached the mosque. Then he went back and took a ritual bath (ghusl), then returned. The Prophet (peace and blessings be upon him) saw the traces of the bath on him, so the Prophet (peace and blessings be upon him) asked him about his bath. He said: I heard your (peace and blessings be upon him) call while I was having intercourse with my wife, so I got up before finishing (ejaculating) and took a bath. The Prophet (peace and blessings be upon him) said: "Water is only (required) because of water (being emitted)." Then after that the Messenger of Allah (peace and blessings be upon him) said: "When the two circumcised parts meet, ghusl becomes obligatory."
Hadith Referenceالمعجم الكبير للطبراني / باب الراء / 4359