Reference: al-Muntaqaa min Fataawa Shaykh Saalih al-Fowzaan – Volume 5, Page 40, Fatwa No.59
Question: Is the prostration of forgetfulness (sujood as-sahoo) to be done before the tasleem (completion of the prayer) or after it, or are there situations where it is to be done before the tasleem and [likewsie] situations where it is to be done after it?
Response: It is permissible to do the prostration of forgetfulness before the tasleem and after it. However, that which is best is to do it before the tasleem if one missed something from the prayer such as not having done the first tashahhud or having missed out an obligatory part of the prayer, such as the saying of “Subhaana Rabbee al-‘Adtheem” in the rukoo’ or [the saying of] “Subhaana Rabbee al-A’laa” in the sujood.
However, if it (the prostration of forgetfulness) was [to be done] for something which was extra, such as having done the tasleem before completing it (the prayer) or for rising up for the fifth [rak’ah] in a four [rak’ah prayer] or the third [rak’ah] in a two [rak’ah prayer] or the fourth [rak’ah] in the maghrib [prayer] and then he remembered and [immediately] sat down [again], then it is best that [the prostration of forgetfulness] is done after the tasleem.
So that which is forgetfully done extra in the prayer, then it is best that [the prostration of forgetfulness] is done after the tasleem and if he were [instead] to always do it before the tasleem or always to do it after the tasleem then there is no harm in that, in shaa.-Allaah. and it is mentioned of the Messenger (sal-Allaahu ‘alayhi wa sallam) this and that [Saheeh al-Bukhaaree (2/65) hadeeth of ‘Abdullaah ibn Buhaynah (radhi-yAllaahu ‘anhu)].