Abdullah bin Arqam reported,

He set out for Hajj or Umrah with people accompanying him, and he was leading them in prayer. One day, he announced the iqamah for the dawn prayer and then said, "Let one of you step forward to lead," and he went off to relieve himself. He explained, "I heard the Messenger of Allah ﷺ say, 'When one of you needs to relieve himself and the prayer has been called, let him begin with relieving himself.'"

Abu Dawud 88

Sahih

حدثنا أحمد بن يونس حدثنا زهير حدثنا هشام بن عروة عن أبيه

عن عبد الله بن الأرقم

أنه خرج حاجا أو معتمرا ومعه الناس وهو يؤمهم فلما كان ذات يوم أقام الصلاة صلاة الصبح ثم قال ليتقدم أحدكم وذهب إلى الخلاء فإني سمعت رسول الله ﷺ يقول إذا أراد أحدكم أن يذهب الخلاء وقامت الصلاة فليبدأ بالخلاء

أبو داود 88صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Purification
Chapter
A man praying while needing to relieve himself
Numbering
Darussalam 88
Abu Dawud 88