The Qur'an indicates, when recounting Prophet Sulayman alaihis salaam’s life, that ants have a communication system:
Then, when they reached the Valley of the Ants, an ant said: ‘Ants! Enter your dwellings, so that Sulayman and his troops do not crush you unwittingly.’ [Qur'aan, 27:18]
Scientific research has revealed that ants have very organised social lives and they also have a complex communication network. Ants use a variety of methods to communicate, thanks to their very sensitive sensory organs. They mainly communicate on the chemical level. They have chemical compounds that are perceived by smell and secreted by internal glands.
To know that ants communicate and how they do it requires scientific knowledge which is pretty recent. The fact that the Qur'an emphasized this fact 1,400 years ago, a time when there was no such knowledge about ants, is another one of its miracles.