Yes, 'to' can be used in such cases.
"Stand to the right" as you say means "stand on the right," or another way of putting it, "stand towards the right." "towards""Towards" in this case doesn't mean moving in a direction, just in what directionmore on one side, stationary i.e. face towards eastor "stand more on the right side."
Other cases where 'to' is used are "Stand to attention." It doesn't mean direction of moving, just directing the person what to do.