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.
Sunan Abi Dawud Book 2, Hadith 626