Answer: Ants are not generally considered a plant pest. They are usually in the soil near plants which provide a food source - either nectar or insects. I don't think they caused the death of your rosemary but rather they moved into the soil because it was dry and offered some protection. It could also be that your rosemary had an aphid infestation. Ants herd aphids because aphids excrete a sticky substance called honeydew. Honeydew is a sweet liquid that ants enjoy feeding on - so much so that ants will often protect aphids from predators so the ants will have an unending source of honeydew.
In any case, unpotting the rosemary and exposing the ants will probably make them search out other places to live. When you pot up your new aloe, make sure you sift through the potting soil and remove any ant eggs that may be present. It isn't likely a new committee of ants will take up residence in the soil of your aloe.
Best wishes with your garden!
Q&A Library Searching Tips