If they get green cards they are not illegal.
If they break the law to get a green card, they are still illegal.