When a critical entity (i.e. hero in regicide) is given an order to garrison, any current guards it may have will stop following it when it garrisons in the holder. This means that the guards will stay positioned where they happened to be at the time (often in enemy territory) until the critical entity ungarrisons. This is especially common if the guarded is a fast cavalry hero that has just retreated from enemy territory.
moveToRange is used to keep the guards from "bunching up" against the garrison holder.