The Quran mentions ants in the story of Prophet Sulaiman AS. While traveling with a large army, the ants panicked and hid to avoid being trampled. This tale is recorded in Surah an-Naml verse 18.
Prophet Sulaiman AS was not only Allah's messenger but also king of Bani Israil. He was granted immense wealth, knowledge, and inspiration, making him a wise, intelligent leader who upheld justice.
Allah bestowed miracles upon him, including control over wind, sea, and animals. The son of Prophet Daud AS could travel by riding the wind and command jinn and birds, for instance in battles.
One day, Prophet Sulaiman AS journeyed to his domain with a vast army of humans, jinn, and birds. He organized the troops: the front guarded boundaries, the rear ensured no one lagged behind.
Midway, they entered a valley full of ant nests. Seeing the massive force, the ants feared being crushed. The queen ant, said to be named Jirsan, ordered the ants into their holes.
This story appears in the Quran, Surah an-Naml verse 18: "O ants, enter your dwellings, lest Sulaiman and his soldiers crush you while they perceive not."
The tale highlights Prophet Sulaiman AS's ability to understand animal languages, as granted by Allah.