You don't.
Again, most western and European countries allow Non-Citizen to join their Armed Forces.
US Military - USCIS (Immigration) have a special pathway that allow Green Card Holder to naturalise as US Citizen while serving or served the US Military
If you are serving or have served in the U.S. armed forces and are interested in becoming a U.S. citizen, you may be eligible to apply for naturalization under special provisions of the Immigration
www.uscis.gov
Canadian Military - Same pathway offered by Candian IRCC
Find out if you’re eligible for citizenship: Canadian Armed Forces
www.canada.ca
British Military - UK allow Citizens of Commonwealth Country to join their Military - Although now recruitment is suspended to all commonwealth country other than Ireland due to
Sickle Cell Trait
As a British citizen, you're able to join the British Army. Certain terms apply for applications from the Commonwealth. See if you can join the British Army.
apply.army.mod.uk
French Foreign Legion - well, need I say more??
How to join the French Foreign Legion. Entry requirements, recruiting centers. Entry tests. Pay - salary, Career in the Legion. Where to join the Legion, what to take with you.
foreignlegion.info
Australian Defence Force - Australian is probably the harshest of the bunch but still allow non-Citizen to fill Defence Role if they can't find any
Want a career with rewarding work, a competitive salary, travel and more? Find out everything you need to know about joining the ADF.
www.defencejobs.gov.au
Las Fuerzas Armadas Españolas - Spain allow Resident of Spain and other Spanish speaking country to join their reserve
Todos los civiles tienen el derecho constitucional de poder participar en la defensa de España, dedicando voluntariamente parte de tu tiempo a las Fuerzas Armadas.
reclutamiento.defensa.gob.es
You will be treated like an American POW as you are issued with a Geneva Convention Identification Card even if you are not US Citizen serving with the US MIlitary
This is Article 47 of Geneva Convention 1949, which defined the term Mercenaries, read part D, E and F