The short answer is no, undocumented immigrants can’t join the US military.
Quoting from the US Army recruiter FAQ:
Can non-U.S. citizens join the Army?
Enlistment into any branch of the U.S. military, by citizens of countries other than the United States is limited to those foreign nationals who are legally residing in the United States and possess a Bureau of Citizenship and Immigration Services Alien Registration Card (INS Form I-151/551 - commonly known as a “Green Card”). Applicants must be between 17 and 35; meet the mental, moral, and physical standards for enlistment; and must speak, read and write English fluently.
The short answer is no, undocumented immigrants can’t join the US military.
Quoting from the US Army recruiter FAQ:
Can non-U.S. citizens join the Army?