"I'm a soldier, not a diplomat" -James T. Kirk
A soldier was a participant of a military conflict, or any member of a military, regardless of position.
Though not strictly a military organization, Starfleet sometimes put its members in the position of being soldiers. Miles O'Brien often talked about his time as a soldier while fighting the Cardassians. (TNG: "The Wounded", DS9: "Empok Nor")