Your wording sounds like you're posting this as a "gotcha". Would you like to elaborate further?
And as a response to your perceived "gotcha", no, they do not need to be illegal. Even a refugee with a medical degree in their home can arrive here and can fall through the cracks in our system just because they aren't able to master a second language fast enough. Not every immigrant is illegal, no matter the pearl clutching.