Aliens serving in the US military did not gain citizenship through service alone. The naturalization of soldiers was performed under certain provisions of nationality law facilitating the naturalization of members of the US armed forces.
These provisions waived the Declaration of Intention requirement and waived or reduced the residency requirement. Thus many soldiers filed petitions and were naturalized the same day.
Search WW1 Soldiers Naturalization Records 1918 index cards with names, dates of naturalization, court numbers, and certificate numbers of soldiers in WWI whose naturalizations were facilitated so they could serve in the US Armed Forces.