The Prophet ﷺ said, "Whoever touches his private part must not pray until he performs ablution."
حدثنا إسحق بن منصور قال حدثنا يحيى بن سعيد القطان عن هشام بن عروة قال أخبرني أبي
أن النبي ﷺ قال من مس ذكره فلا يصل حتى يتوضأ
[Its chain of transmission is sahih]. Ibn Majah also narrated it, in the Book of Purification, chapter on wudu after touching the penis, hadith no. 479, from the hadith of Hisham with the same wording. There is another route for it in Abu Dawud, hadith no. 181, and elsewhere, from Urwa with the same wording.There are also narrations on this subject from Umm Habiba [Ibn Majah, hadith no. 481], Abu Ayub [Ibn Majah, hadith no. 482], Abu Hurairah [Ahmad 2/333, and Ibn Hibban graded it sahih, hadith no. 210, and Hakim 1/138], Arwa bint Unays [see Talkhis Habir 1/124–125], Ayesha [Daraqutni 1/54], Jabir [Ibn Majah, hadith no. 480], Zayd bin Khalid [Ahmad 5/194], and Abdullah bin Amr [Ahmad 2/223, and Ibn Jarud graded it sahih, hadith no. 19].