Swarm intelligence (i.e. emergent intelligence) is certainly possible because that is how our brains work. Individual cells each decide where they need to be located and what they need to do. No individual cell has any idea what the bigger picture is, but it just follows a simple set of rules. The end result of this is that after a few years the swarm of human cells can hold a conversation with you.
Relevant questions regarding using ants rather than neurons to form a swarm intelligence would include whether the ants are able to maintain a coherent map of network connections between ants despite individuals being mobile (as opposed to neurons which are largely stationary). Another question would be whether the ants are able to maintain a network connectivity with high enough bandwidth and low enough latency.
I would suggest that your ants use optical communications rather than pheromonal (which is what real ants use). Each ant could have a gland which glows to transmit light (like a firefly gland but smaller). The gland should be recessed in a mirrored pocket on the body. The recessed pocket will make the signal narrow, so only a few ants will be able to see it (thus reducing the problem of cross-talk and increasing the signal strength to the chosen ant). The mirrored interior of the pocket would maximize the efficiency of the light emitter.
There should also be a light receiver, which would be an eye which has been optimized for looking at narrow viewing angles at just the specific wavelength used by the trasmitters. In other words, a telephoto lens.
Each ant should have multiple transmitters and receivers so she can communicate with multiple other ants simultaneously. (Many neurons either transmit or receive from multiple neurons at once.) Transmitters and receivers should be steerable - either on stalks, or perhaps more robustly mounted to the carapace in ball and socket joints (like human eyeballs are mounted to the skull).
Ants which are currently tasked with thinking should avoid moving around a lot to avoid breaking connections. They should also hang out in three dimensional environments like large caverns where they can hang from the walls and ceiling allowing thousands of ants to talk to thousands of other ants. This will improve data processing speed. Obstructing line of sight will impede efficiency.
Each ant needs to have a name (in computer terms, an address). Each ant would memorize the names of all ants it connects to. If two ants lose connection they each broadcast their names until they are able to reconnect.
Each ant should probably also have a youthful understudy who is expected to take over that network node when its elder dies. That way the mind would outlast the lifespan of individual ants.
Lastly, nobody can answer what kinds of evolutionary pressure would result in sentience. We've only seen it happen a single time (in the case of human ancestors) and we have no idea what was different about this situation. I would suggest you make up anything that seems plausible to you. Whatever your explanation, I would urge you to make it an unusual collection of events that has not happened before with other organisms.