At length, when they came to a (lowly) valley of ants, one of the ants said: "O ye ants, get into your habitations, lest Solomon and his hosts crush you (under foot) without knowing it." (18)
Tafsir
In Solomon’s army there were not only human beings but also genies and birds. Once Solomon’s army passed through a valley where there was a large number of ants. On this occasion Solomon understood what the ants were saying to each other. Such an incident would be enough to give rise to conceit and pride in an ordinary man. But, Solomon became the embodiment of gratitude on this account. He fully attributed to God whatever appeared to be his—and this is the way of a pious and righteous man.
Alternatively, you may use the smart search feature provided below