This happens only (afaik) if the unit ist stuck between two objects, or if the unit has been affected by the shock grenade thingy of the Elite Troops commander.
The bug has been around since the beginning (?) and has not been fixed so far.
no, it happens to me at the normal retreat sometimes.....