It is prescribed to do sujood al-sahw in naafil prayers just as it is prescribed to do it in the obligatory prayers when there is a reason for doing it.
This is the view of the majority of scholars ancient and modern, because of the general meaning of the words of the Prophet (peace and blessings of Allaah be upon him): âIf any one of you forgets something in the prayer, let him do two prostrations.â Narrated by Muslim, 402
Also, correcting the prayer and annoying the Shaytaan are things which may be needed in the naafil prayers just as in the obligatory prayers.
Some scholars â including Ibn Sireen, Qutaadah, âAtaâ and a number of the companions of al-Shaafaâi were of the view that there is no sujood al-sahw in voluntary (naafil) prayers. But the correct view is that of the majority.
Al-Bukhaari (may Allaah have mercy on him) said in his Saheeh: âBab al-Sahw fiâl-fard waâl-tatawwuâ (Chapter on forgetfulness in obligatory and voluntary (prayers)). Ibn âAbbaas (may Allaah be pleased with him) did two prostrations after Witr, and al-Haafiz said in al-Fath, commenting on the report of Ibn âAbbaas: this was narrated by Ibn Abi Shaybah with a saheeh isnaad.
The point of quoting what Ibn âAbbaas did is that Witr is not obligatory, but Ibn âAbbaas did sujood al-sahw in it, which indicates that sujood al-sahw should be done in both obligatory and naafil prayers.
Shaykh Ibn âUthaymeen said: Sujood al-sahw is two sajdahs (prostrations), and should be done in both obligatory and naafil prayers if there is a reason for doing it.
Majmooâ Fataawa Ibn âUthaymeen, 14/68
See Kitaab Sujood al-Sahw fi Dawâ al-Kitaab waâl-Sunnah al-Muttaharah by Shaykh âAbd-Allaah al-Tayyaar.