Whether the child of an undocumented (often referred to as illegal) immigrant can stay in the United States depends on whether the child was born in the U.S. and, if not, whether the child qualifies for any other form of immigration relief.
The 14th Amendment to the U.S. Constitution reads: "All persons born or naturalized in the United States, and subject to the jurisdiction thereof, are citizens of the United States and the State wherein they reside."
The Amendment was originally ratified in 1868 so that newly emancipated slaves (who were originally from Africa) were given citizenship. It has, so far, been interpreted to mean that children born in the United States to undocumented aliens can legally stay in the United States as U.S. citizens.
However, many people argue that allowing citizenship to the children of undocumented immigrants was not the original intent of the authors of the 14th Amendment (who didn't even consider the issue of immigration, because no limits then existed on who could enter the United States). Members of Congress occasionally raise the possibility of legislatively changing this interpretation of the Constitution in order to deny citizenship to children of undocumented immigrants.
The 14th Amendment is also understood to prohibit children born to foreign visitors, ambassadors, consuls, etc, from becoming citizens simply because their parents were in the United States on the errand of their native country at the time a child was born.
Many undocumented immigrants bring their children to the U.S. when the children are very young. The children grow up speaking English, attending U.S. schools, and in every way considering themselves equivalent to U.S. citizens. However, under current law (despite various legislative proposals), they have no direct path to citizenship.
That doesn't mean that their situation is hopeless, however. Such children might, for example, qualify for asylum; for a green card based on marriage or another close family relationship to a U.S. citizen or permanent resident; or if they find themselves in removal proceedings (before an immigration judge), for a form of relief called cancellation of removal. Still, the path to a green card under any of these scenarios will not be easy, and the fact of their long stay in the U.S. may, in some instances (particularly after the child turns 18), hurt their ability to obtain the green card.
If you have questions about your immigration status or that of your child, consult an experienced immigration attorney. The attorney can help analyze who is a citizen and whether non-citizens have a possible path to a green card.