A lot of animals, specially birds use the Earth magnetic field to orientate on their flight across the Earth. Now some scientist suggest that ants has on their antenna a kind of magnetite crystals by which they also can use the magnetic field. But for what would and could an ant use this huge magnetic field, while they just walk for only meters a day?
Hard to say, but for at least one ant species (see below) it seems to be an orientation cue for (relatively short-distance) migration (even if you're only going a few meters, it can be important to walk in a straight line!). At present it seems we know something about the proximal mechanisms of magnetoreception, and a little bit about the observed behavioural patterns, but don't have much more than informed speculation about the ecological/evolutionary advantages of this form of spatial orientation.
Searching "ant magnetotaxis" gets to this article on magnetotaxis in the migratory ant Pachycondyla marginata:
The influence of geomagnetic field changes on the behavior of ants has been studied in the species Solenopsis invicta (Anderson and Vander Meer, 1993), Formica rufa (Çamlitepe and Stradling, 1995), and Oecophylla smaragdina (Jander and Jander, 1998) ... Another migratory insect species is the ant Pachycondyla marginata, which has very peculiar habits: a diet of living termites and migration in a preferential direction (Leal and Oliveira, 1995). These habits make such a migratory ant very attractive for the study of biomineralized magnetic materials.
From Leal and Oliveira 1995 ref above:
Migration by P. marginata colonies lasted over 2 days and covered distances of 2-97 m (n=48).
Selections from Acosta-Avalos et al. 2001 Naturwissenschaften:
abstract: Migrations during the dry/cold season are significantly oriented 13 degrees with the magnetic North-South axis, while rainy/hot migrations do not exhibit a preferred direction. This result is discussed considering the hypothesis that P. marginata ants may use the geomagnetic field as an orientation cue for migrations in the dry/cold season.
Given that colonies resume nest relocation late in the afternoon of the second day, most of the migratory process takes place under darkness conditions.
On the other hand, nest relocations in the dry/cold season can be considered as typical migrations.
The use of geomagnetic cues is more commonly associated with darkness conditions, as reported for mole rats (Marhold et al. 1997) and also proposed for bumblebees (Chittka et al. 1999). As P. marginata ants start the migratory process in the afternoon, they can use any of those cues in their orientation during the migratory journey. However, it is intriguing that they prefer an axis around the North–South axis to migrate. The only possible cue to give this information under all conditions is the one provided by the geomagnetic field.