A character can charge out of a unit, by declaring a charge in the relevant phase – in which case, they will move and their unit will stay still – it is not permitted to declare a charge of its own, though it can move during the Remaining Moves phase. If a unit contains multiple characters, only one of them may charge out of the unit per turn.
If a Stand and Shoot reaction is declared against a character charging out of a unit, the shots are fired at the character as if they were a separate target – they do not gain the same protection as being inside a unit, but they do get a 4+ "Look Out, Sir!" if the unit they are leaving is the same troop type as they are.
Alternatively, any character can leave their unit during the Remaining Moves sub-phase by moving away from the unit before that unit makes its own move. If the unit cannot move in this phase for any reason, the character may not leave the unit. a character may not leave a unit on the same turn that they join it.
If the character itself cannot move, the unit may choose to leave them behind. Mark the spot where the character is and move the unit as normal, then place the character back in that spot. If the unit cannot move far ahead of the character model for any reason, it cannot leave the character behind.