Israel had a unit called the Mahal, where both Jewish and non-Jewish volunteers were allowed to migrate to Israel to fight in the 1948 Arab-Israeli War including Aliyah Bet.
About 4,000 volunteers from all over the world came to fight on the Israeli side.
Mahal made up a small fraction of the Israeli forces, except for the Air Force, where they were dominant.
Mahal was disbanded after the war, and most volunteers left Israel. Some, however, made their immigration permanent and became Israeli citizens.
The US government had a policy in place, by which a LEGAL immigrant, with intent to become a citizen, could serve in the US military for a period of five years, and this would qualify as “residency” for purposes of naturalization, even though the applicant served outside US boundaries for the most of the duration. Extending this opportunity to various non-legal or extra-legal residents was not considered until very recently in this nation’s history.
Of course, that territory on the North American continent once known as “the United States of America” is no longer held to this standard.