Moisture-loving fungi evolved in wet forests, and would have been poorly equipped to survive on their own in this changing environment.
The findings, published in the journal Proceedings of the Royal Society B, are the fruit of intense genetic sleuthing.
Using powerful new tools, scientists compared some 1,500 stretches of DNA in 119 modern ant species, two-thirds of them farming ants.
By identifying the non-farming ant most closely related to the fungi-cultivating species, they were able to construct an evolutionary tree going back in time.
"Higher agricultural-ant societies have been practicing sustainable, industrial-scale agriculture for millions of years," said lead researcher Ted Schultz, the museum's curator of ants.
There may be lessons there for our own species, he added.
"They provide all the nourishment needed for their societies using a single crop that is resistant to disease, pests and droughts at a scale and level of efficiency that rivals human agriculture," he said in a statement.