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.