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 Jinns saw plainly that if they had known the unseen, they would not have tarried in the humiliating Penalty (of their Task).
Another meaning of the sentence can be: “The true state and condition of the jinns became clear and exposed. “According to the first meaning, it will mean: “The jinns realized that their claim to have the knowledge of the unseen was wrong.” According to the second, it will mean: “The people who thought that the jinns possessed the knowledge of the unseen, came to know that they had no such knowledge.”
Some modern commentators have interpreted it as follows: As the Prophet Solomon’s (peace be upon him) son, Rehoboam, was unworthy and given to luxurious living and surrounded by flatterers, he could not sustain the heavy burden of responsibility that fell on his shoulders after the death of his great father. A short time after his succession, the kingdom collapsed, and the frontier tribes (i.e. of the jinns), whom the Prophet Solomon (peace be upon him) had subdued by his mighty power, rebelled and broke away. But this Interpretation does not at all conform to the words of the Quran. The scene depicted by the words of the Quran is somewhat like this:Death came to the Prophet Solomon (peace be upon him) in a state when he was standing or sitting with the support of a staff. His body stood in place due to the staff, and the jinns continued to perform their duties and services, thinking that he was living. At last, when the wood louse started eating away the staff and it became hollow from within, the Prophet Solomon’s (peace be upon him) body fell down; then the jinns realized that he had died. After all, why should this clear and unambiguous description of the event be construed to mean that the wood louse implied the unworthiness of the Prophet Solomon’s son, and the staff implied his power and authority and the falling down of his body implied the disintegration of his kingdom? Had Allah meant to say all this, there was no shortage of the words in the vast Arabic language. The Quran, in fact, has nowhere used such enigmatic language. How could the common Arabs, who were its first addressees, have solved this riddle? Then, the most absurd part of this Interpretation is that according to it the jinns imply the people of the frontier tribes whom the Prophet Solomon (peace be upon him) had subdued to perform certain services under him. The question is, which of these tribes had claimed to have the knowledge of the unseen, and whom did the mushriks regard as the knower of the unseen? A person who reads the last words of the verse with open eyes can himself see that jinn here necessarily implies a group of beings who either had themselves made a claim to have the knowledge of the unseen, or who, the people believed, had the knowledge of the unseen; and the secret of this group’s being ignorant and unaware of the unseen became disclosed when they continued to serve the Prophet Solomon (peace be upon him) under the impression that he was living, whereas he had died. This statement of the Quran was enough to induce an honest person to revise his this opinion that the jinn imply the frontier tribes, but the people who feel shy of admitting the existence of the hidden creation called the jinn before the materialistic world still insist on this Interpretation of theirs in spite of the plain meaning of the Quran. At several places in the Quran Allah tells that the mushriks of Arabia regarded the jinns as the associates of Allah, and as His children, and used to seek their refuge: “They set up the jinns as partners with Allah. whereas He has created them.” (Surah Al-An’aam, Ayat 100 6:100 ). “And they have invented a blood-relationship between Allah and the jinns.” (Surah As-Saaffaat, Ayat 158 37:158 ). “And that, some people from among the men used to seek refuge with some people from among the jinns.” (Surah Al-Jinn, Ayat:6 72:6 ). One of their beliefs was that they regarded the jinns as the knower of the unseen and hidden. and used to turn to them to obtain knowledge of the hidden things. Allah has related this event here in order to repudiate this belief and to make the Arabs realize that they are following the false creeds of ignorance without any valid reason, whereas the fact is that these beliefs are absolutely baseless. (34:63)
Maududi, Abul Ala (2010). Tafhim ul Quran. https://www.englishtafsir.com/Quran/27/index.html