Some ants can survive under water for up to 14 days. Water temperature is the most-important determining factor in the time, with lower water temperatures facilitating longer survival times.
Ants live in nearly every terrestrial habitat on Earth. In some cases, an ant's habitat is subject to flooding or the ant needs to cross a body of water during foraging. Ants, like many insects, breathe through specialized openings in the abdomen. An ant can close these spiracles during submergence in water and can also lower necessary bodily functions, entering a torpor-like state. In this state, the ant requires 20 times less oxygen than it needs while sleeping. The lower the water temperature, the easier it is for the ant to maintain this lower metabolism and the longer it survives below water.
In some cases, ants allow an air bubble to form around their abdomen, enabling them to obtain oxygen while under water for a short period of time. One species of Australian ant, Polyrhachis sokolova, lives in a nest in mangrove mud. These nests flood frequently, for up to 3.5 hours at a time. To cope with the flooding, the Polyrhachis build air pockets into their nests, allowing the ants to remain in the nest until the water subsides.