I asked Mujahid about the prostration in Surah Sad. He said, "Yes, I asked Ibn Abbas about it, and he said, 'Do you recite this verse, "And from his descendants, Dawud and Sulayman," up to its end, "so follow their guidance"? Your Prophet ﷺ was commanded to follow the example of Dawud.'"
حدثنا يحيى بن عبد الملك بن أبي غنية قال أنبأنا
سألت مجاهدا عن السجدة التي في ص فقال نعم سألت عنها ابن عباس فقال أتقرأ هذه الآية {ومن ذريته داود وسليمان وفي آخرها فبهداهم اقتده} قال أمر نبيكم ﷺ أن يقتدي بداود
Its isnad is sahih. Ibn Kathir cited it in his tafsir, 7:194, from Bukhari, via the route of Muhammad bin Ubayd Tanafisi from Awwam. He also cited it, 3:357, from Bukhari, via the route of Sulayman Ahwal from Mujahid, with the same meaning. See the one before it.