So look to the ants and how God has inspired them to the action of gathering together for the gathering of their sustenance, and their cooperation regarding that task, and their preparation for the time of their inability to depart [from their home], and their regulation on account of heat and cold. They are inspired regarding the matter of inconstancy of conditions to determination towards outcomes which are not immediately known, so that you can see in that matter that when one of them is incapable of bearing what he bears, or is struggling with it, he is aided by another ant. So the cooperative activity of transporting [among the ants] is like the humans cooperating in labor that cannot be completed save through cooperation.
Then, they are inspired to delve houses into the earth, beginning in that by expelling the dirt, and setting out for grains in which is their sustenance, and dividing them up lest they sprout in the moistness of the earth- and none other created this aspect in their nature save the Merciful, the Compassionate. Then, if moisture encounters the grain, they take them out and spread them out until they dry. They only build houses in elevated locations of the earth, places that are dry, without streams that could flood the houses.
Abū Ḥāmed Muḥammad ibn Muḥammad Ghazālī (1058-1111), The Wisdom in God’s Creation
See also: On the Spider, On the Human Eye