Shaddad bin Had reported,

The Messenger of Allah ﷺ came out to us for one of the evening prayers carrying Hasan or Husayn. The Prophet ﷺ went forward, placed the child down, then said the takbir and began the prayer. During the prayer, he made one prostration that he prolonged greatly.Ubayy said, "I raised my head and saw the boy on the back of the Messenger of Allah ﷺ while he was prostrating, so I returned to my prostration."When the Messenger of Allah ﷺ finished the prayer, the people said, "Messenger of Allah, you made a prostration during your prayer that you prolonged so much that we thought something had happened, or that revelation was being sent down to you."He replied, "None of that occurred. Rather, my son had mounted my back, and I disliked rushing him until he finished what he wanted."

Azami 2630

Sahih

عن عبد الله بن شداد، عن أبيه قال

خرج علينا رسول الله ﷺ في إحدى صلاتي العشاء، وهو حامل حسنا أو حسينا، فتقدم النبي ﷺ فوضعه، ثم كبر للصلاة فصلي، فسجد بين ظهراني صلاته سجدة أطالها، قال أبي: فرفعت رأسي، وإذا الصبي على ظهر رسول الله ﷺ وهو ساجد، فرجعت إلى سجودي، فلما قضى رسول الله ﷺ الصلاة، قال الناس: يا رسول الله! إنك سجدت بين ظهراني صلاتك سجدة أطلتها حتى ظننا أنه قد حدث أمر، أو أنه يوحى إليك؟ قال: فكل ذلك لم يكن، ولكن ابني ارتحلني، فكرهت أن أعجله حتى يقضي حاجته.

الأعظمي 2630صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Minor actions do not invalidate the prayer
Section
Carrying children during prayer
Numbering
Jami al-Kamil 2630 (2nd edition)
Azami 2630