The Book of the Prohibited actions

Riyad as-Salihin · Chapter 339

Abomination of Joining As-Salat (The Prayer) when the Food is ready or when one is in desperate need to answer the call of Nature

باب كراهة الصلاة بحضرة الطعام ونفسه تتوق إليه أو مع مدافعة الأخبثين‏:‏ وهما البول والغائط

Prayer asks for a settled, attentive heart, and that is hard to find when the body is pulled elsewhere. This chapter notes two such distractions: hunger for food already served, and the urgent need to relieve oneself.

The guidance is gentle and practical: tend to the pressing need first so you can pray with presence rather than struggle through it. The aim is worship that the heart is actually free to give.

Hadith 1753

'Aishah (May Allah be pleased with her) said:

عن عائشة رَضِيَ اللهُ عنها، قالت: سَمِعْتُ رسولَ الله - صلى الله عليه وسلم - يقولُ: "لا صَلاَةَ بِحَضْرَةِ طَعَامٍ، وَلاَ وَهُوَ يُدَافِعُهُ الأَخْبَثَانِ" . ((رواه مسلم‏)) ‏

I heard the Messenger of Allah (ﷺ) saying, "No Salat (prayer) should be performed when the food has been served, nor should it be performed when a person is in need of relieving himself." [Muslim].

In plain words

The Prophet taught that one should not pray when food has just been served, nor while badly needing to relieve oneself. Settling such distractions first lets the heart attend to the prayer.

Reference : Riyad as-Salihin 1753 In-book reference : Book 17, Hadith 243