Abu Hurairah (RA) reported: The Messenger of Allah (ﷺ) said: A woman, an ass and a dog disrupt the prayer, but something like the back of a saddle guards against that.
Related hadith on this topic
Explanation & Benefits
Shaykh Maulana Abdul Aziz Alvi
Hadith Commentary: Benefits and Issues: Looking at a donkey, a black dog, or a woman affects a person’s thoughts and mind. There is a risk of harm and evil from donkeys and dogs, and a woman possesses sexual attraction. Therefore, the humility, submissiveness, and concentration required in prayer are not maintained, and these are the very qualities sought in prayer. For this reason, it has been expressed as the prayer being “broken.” If these things are beyond or far from the sutrah (prayer barrier), then attention is not drawn to them, and thus the prayer is not affected. In any case, according to the majority, the prayer does not become invalid, but a deficiency is created in it, and according to Arabic idiom, this has been expressed as “breaking” the prayer.
Source: Tuhfat al-Muslim: Commentary on Sahih Muslim, Page: 1139