... Louis XIV ...
Louis XIV became king at age 4. Elizabeth came to the throne as an adult. Like her husband - who was a prince before becoming a UK citizen - she served in the UK military. IIRC, she was a driver and mechanic; Philip, a Prince of Greece, served in the RN, on a battleship and one or more destroyers in the Med (fairly hazardous duty). I got curious, and learned that her father, George VI (Prince Albert, second in succession, at the time), served in the RN, including on a battleship at Jutland. He went on to serve in the nascent RAF.
Had Louis become king as an adult, I doubt he would have served in France's military.