Sulaiman ibn Dawood was, according to the Quran, a Nabi ( Prophet) of the Israelites. Generally, Islamic tradition holds that he was the third king of the Jewish people and a wise ruler of Israel.
The Quran relates that Solomon died while he was leaning upon his staff and that he remained standing, propped up by it, until a little creature – ant or worm – gnawed at it, until, finally, it gave way – and only then did his body collapse.
Then, when We decreed (Solomon’s) death, nothing showed them his death except a little worm of the earth, which kept (slowly) gnawing away at his staff: so when he fell down, the Jinn saw plainly that if they had known the unseen, they would not have tarried in the humiliating Penalty (of their Task).
— Qurʾan, Surah 34 (Sabaʾ), Ayah 14
As he remained upright, propped on his staff, the jinn thought he was still alive and supervising them.
They realized the truth only when God sent a creature to crawl out of the ground and gnaw at Solomon’s staff, until his body collapsed. This verse is understood to teach the audience that jinn do not know the unseen (Al-Ghaib) – had they known it, they would not have remained toiling like fools in the service of a dead man.