You can have enemy units do that (it happens to your units as well) if a unit is not targeting a unit and the pathfinding doesn't prevent it, this happens.
Basically, the problem here is simultaneous turns. All units move at the same time. Because humans are slow, the effect is that everyone else moves at once and the humans at another time. This results in AI vs. AI sometimes having a hard time targeting the other. It's not common but it is also not a rare thing either. It is something we do keep trying to address in updates but it's non-trivial (which is why it's still there).
It's one of the prices we pay for our very very fast turn times compared to other games.