You gotta ask, who exactly is going to be bringing the Commander up on charges?
In order to be courts martialed, the Commander's reporting authority (her Captain) has to prefer charges against her in the first place. Then someone else, like Starfleet JAG corp, has to do a independent investigation. It's also possible that someone at Starfleet command will read about the incident in the Captain's log and figure out the sequence of events.
So, how big an asshole is this Captain who managed to get him self kidnapped? Will he bring her up on charges, will he leave the fact out of his log, if for no other reason than it makes him look like a fool.