People who are in the US and have either fallen out of status or entered illegally generally cannot get the green card in the US. The only exceptions are:
In order to qualify for 245(i), the person must:
If neither of these conditions is met, the person does not qualify for 245(i) and would need to leave the US to process for an Immigrant Visa in their home country. However, if the person has accumulated unlawful presence in the United States, the person will be barred from returning to the US for several years from the date they leave the US.
A person accumulates unlawful presence if, after the age of 18, they fall out of status, or otherwise are in the US without valid immigration status.
If a person accumulates 180 days or more of unlawful presence, they are barred from returning to the US for three years. If they accumulate one year or more of unlawful presence, they are barred from returning to the US for ten years. In order to return before teh period they are barred for elapses, the person would need to apply for and be granted a waiver. Such a waiver will require proving hardship to a US citizen or Permanenet Resident parent, spouse or child in the US. To apply for such a waiver, a competent immigration attorney should be retained, as that will ensure that the application is as strong as possible.