"Unauthorized immigrants are not currently allowed to enlist in the US Armed Forces voluntarily (although they may be drafted, if there is a military draft).
People with work permits or “deferred action” are likewise currently
ineligible for voluntary enlistment. The announcement by DHS does not
change the military enlistment law found at 10 United States Code § 504.
This law limits military enlistments to US citizens; US nationals;
lawful permanent residents; certain lawfully present persons from Palau,
Micronesia, and the Republic of the Marshall Islands; and certain other
persons whose enlistment has been determined by a Service Secretary to
be “vital to the national interest.” No Service Secretary has to date
authorized the enlistment of people who have merely been granted
“deferred action.”" - Margaret D. Stock, June 19, 2012.