It is narrated from Sayyiduna Abdullah bin al-Arqam (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "When the prayer has been called (iqamah) and one of you feels the need to relieve himself, let him first relieve himself."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 14051