Unless things have changed, foreign nationals with a green card could , and have served in our military. Check out the stories of citizenship ceremonies conducted in Iraq and elsewhere. As for my personal opinion, if they are willing to lay down their lives defending this country, the are welcome as brothers in arms. Semper Fidelis
Illegal aliens aren't joining the military because they are willing to lay down their lives for America. They are joining the military for all the benefits. If they get killed in the process that's no different than the risk they take illegally crossing the border. These people have no allegiance or loyalty to America or the rule of law. They grow up and live in cultures steeped in corruption and that is what they bring to the US. It doesn't work the other way, they don't become patriotic law abiding Americans.