Generally speaking, a player can move their units however they wish within the confines of the rules governing movement. However, sometimes troops go out of control for some reason, either because they are overcome by sheer terror, because they are compelled by magic, or because they are disorientated (or just not very bright to begin with). The player has no control over the movement of such troops and so these are referred to as compulsory moves.
All compulsory movement is carried out after charges have been resolved, but before other movement takes place.
Fleeing is the most common type of compulsory move - only the luckiest general will not have to witness the unhappy spectacle of their own troops attempting to escape the battle. You must resolve the actions of any fleeing troops before those of other compulsory moves. Fortunately, you have a chance to rally them.