The Messenger of Allah ﷺ led us in the afternoon prayer and gave the closing salutation after only two units. Dhul-Yadayn stood up and asked, "Has the prayer been shortened, Messenger of Allah, or have you forgotten?"The Messenger of Allah ﷺ replied, "Neither has happened."Dhul-Yadayn said, "Indeed it has, Messenger of Allah."The Messenger of Allah ﷺ then turned to the people and asked, "Is Dhul-Yadayn telling the truth?"They answered, "Yes."So the Messenger of Allah ﷺ completed what remained of his prayer, then performed two prostrations while seated.
قال قرأت على عبد الرحمن: مالك وحدثنا إسحاق قال حدثنا مالك عن داود بن الحصين عن أبي سفيان في حديث عبد الرحمن مولى ابن أبي أحمد أنه قال سمعت
صلى بنا رسول الله ﷺ صلاة العصر فسلم من ركعتين فقام ذو اليدين فقال أقصرت الصلاة يا رسول الله أم نسيت فقال رسول الله ﷺ كل ذلك لم يكن فقال قد كان ذلك يا رسول الله فأقبل رسول الله ﷺ على الناس فقال أصدق ذو اليدين فقالوا نعم فأتم رسول الله ﷺ ما بقي من صلاته ثم سجد سجدتين وهو جالس
Its isnad is sahih. Bukhari related it, 1/198, in the Book of Adhan, chapter on whether the imam should act on what the people say when he is in doubt. Muslim related it in the Book of Mosques, 1/310, no. 416, chapter on forgetfulness in prayer. Abu Dawud related it in the Book of Prayer, chapter on forgetfulness in the two prostrations, 1/246, no. 935. Tirmidhi related it, 2/55, no. 267, in the Book of Prayer, chapter on the testimony of faith in the two prostrations of forgetfulness. Nasai related it, 2/145, no. 930, in the Book of Forgetfulness, chapter on what one who forgetfully finishes his prayer after two units should do. And likewise Malik related it in the Book of Prayer, 1/88, no. 47.