Abdullah bin Arqam narrated that the Messenger of Allah, peace and blessings be upon him, said: "When the time for prayer comes and a person needs to relieve himself, he should go to the toilet first."
Hadith Referenceسنن دارمي / من كتاب الصللاة / 1465