I heard the Messenger of Allah ﷺ say, "Two men should not go out to relieve themselves with their private parts exposed, talking to each other, for Allah detests that."
حدثنا عبيد الله بن عمر بن ميسرة حدثنا ابن مهدي حدثنا عكرمة بن عمار عن يحيى بن أبي كثير عن هلال بن عياض قال
سمعت رسول الله ﷺ يقول لا يخرج الرجلان يضربان الغائط كاشفين عن عورتهما يتحدثان فإن الله عز وجل يمقت على ذلك
[Its isnad is daif]. Ibn Majah also reported it in the Book of Purification, chapter on the prohibition of two people gathering together at the toilet, h: 342, from the hadith of Ikrima bin Ammar, with the same wording. Nasai reported it in Sunan al-Kubra, h: 32, 33. Ibn Khuzayma graded it sahih, h: 71, as did Ibn Hibban (Mawarid), h: 137, and Hakim, 1/157, and Dhahabi agreed with him.Ikrima bin Ammar is confused in his hadith from Yahya bin Abu Kathir. It is said that Aban bin Zayd corroborated him, but I did not find this. The hadith has another version with Tabarani in al-Awsat, h: 1286, but its isnad is daif. It also has another route with Ibn Sakan (Bayan al-Wahm wal-Ihyam, 250/260, h: 2460), but its isnad is daif as well.