When the Prophet ﷺ finished two rak'ahs of an obligatory prayer, a man asked him: Messenger of Allah, has the prayer been shortened, or have you forgotten? he replied: I did not do all that. The people said: Messenger of Allah, you did that. Therefore, he offered another two rak'ahs or prayer and did not make two prostrations due to forgetfulness. Abu Dawud said: This tradition has also been narrated by Dawud al-Hussain from Abu Sufyan, freed slave of Ibn Abi Ahmad on the authority of Abu Hurairah from the Prophet ﷺ. This version goes: He then made two prostrations while he was sitting after the salutation.
أَنَّ النَّبِيَّ ﷺ انْصَرَفَ مِنَ الرَّكْعَتَيْنِ مِنْ صَلاَةِ الْمَكْتُوبَةِ فَقَالَ لَهُ رَجُلٌ أَقَصُرَتِ الصَّلاَةُ يَا رَسُولَ اللَّهِ أَمْ نَسِيتَ قَالَ كُلَّ ذَلِكَ لَمْ أَفْعَلْ فَقَالَ النَّاسُ قَدْ فَعَلْتَ ذَلِكَ يَا رَسُولَ اللَّهِ فَرَكَعَ رَكْعَتَيْنِ أُخْرَيَيْنِ ثُمَّ انْصَرَفَ وَلَمْ يَسْجُدْ سَجْدَتَىِ السَّهْوِ