Soldado vs. militar
Spanish is a rich language with various words that can be used to express similar ideas, one of these instances is the case with the words 'soldado' and 'militar'. Both words refer to individuals who are part of an armed force. Nevertheless, they hold different connotations and can be used in different contexts.
Soldado
A soldado is basically someone who is serving in the army, more specifically an enlisted man or woman. The term typically refers to someone of lower military rank. It is similar to 'private' in English military rank terminology.
Mi hermano es un soldado en el ejército.
(My brother is a soldier in the army.)
El soldado está en la línea del frente de batalla.
(The soldier is on the frontline of the battlefield.)
Militar
'Militar' refers to anything related to an army or any other military service. As a noun, it's used in a broad sense to describe anyone who works for the military, regardless of their rank or occupation. Hence, it implies a wider concept than 'soldado'.
Mi padre es militar y trabaja en la base.
(My father is a member of the military and works at the base.)
La vida militar puede ser muy exigente.
(Military life can be very demanding.)
Summary
The primary difference between soldado and militar lies in their level of specificity. While both pertain to people serving in armed forces, soldado exclusively refers to lower-ranked enlisted personnel, equivalent to 'private' whereas militar denotes anyone associated with military service, regardless of rank, making it more encompassing and generic.