The Messenger of Allah ﷺ said, "By Allah, I hear a child crying while I am in prayer, so I shorten it for fear of distressing his mother."
حدثنا قتيبة حدثنا مروان بن معاوية الفزاري عن حميد
أن رسول الله ﷺ قال والله إني لأسمع بكاء الصبي وأنا في الصلاة فأخفف مخافة أن تفتتن أمه
Sahih, and it is agreed upon. Bukhari narrated it, Book of Adhan, chapter on shortening the prayer when a child cries, no. 708, and Muslim, no. 470, from the hadith of Anas, through him.Also in this chapter, narrations are reported from Abu Qatada [Bukhari, no. 868, 707], Abu Saeed [Ibn Abu Shayba, 1/407, no. 4681], and Abu Hurairah [Bukhari, no. 703, Muslim, no. 467].