عَنِ ابْنِ عَبَّاسٍ قَالَ: سَجَدَ النَّبِيُّ صَلَّى الله عَلَيْهِ وَسلم بِالنَّجْمِ وَسَجَدَ مَعَهُ الْمُسْلِمُونَ وَالْمُشْرِكُونَ وَالْجِنُّ وَالْإِنْسُ. رَوَاهُ البُخَارِيّ
Translation
Ibn ‘Abbas said

A prostration when reciting Sad (Al-Qur’an; 38) is not one of those which are divinely commanded, but I have seen the Prophet prostrate himself when it was recited. In a version Mujahid said that he asked Ibn ‘Abbas whether he should prostrate himself when reciting Sad, whereupon he recited, “And among his progeny David and Solomon . . . so copy the guidance they received,” (Al-Qur’an; 6:84-90) and said, “Your prophet was one of those who were commanded to copy them.” Bukhari transmitted it.