Hadithcore
Bulugh al-Maram, 95

Narrated Jabir (rad):

Allah’s Messenger (ﷺ) said: “When two people go together to relieve themselves they should disappear from each other and do not talk, for Allah detests that”. [Reported by Ahmad; Ibn As-Sakan and Ibn Al-Qattan graded it Sahih (sound) but it is defective].

وَعَنْ جَابِرٍ ‏- رضى الله عنه ‏- قَالَ: قَالَ رَسُولُ اَللَّهِ ‏- صلى الله عليه وسلم ‏-{ إِذَا تَغَوَّطَ اَلرَّجُلَانِ فَلْيَتَوَارَ كُلُّ وَاحِدٍ مِنْهُمَا عَنْ صَاحِبِهِ, وَلَا يَتَحَدَّثَا.‏ فَإِنَّ اَللَّهَ يَمْقُتُ عَلَى ذَلِكَ } رَوَاهُ .‏ [1]‏ وَصَحَّحَهُ اِبْنُ اَلسَّكَنِ, وَابْنُ اَلْقَطَّانِ, وَهُوَ مَعْلُول ٌ [2]‏ .‏

References2 variants
In-Book Reference
Book 1, Hadith 113
English Reference
Book 1, Hadith 101