Why are there 12 million undocumented immigrants in the United States? It's partly because the immigration system is such a mess, with long backlogs and limits on visas that have restricted the flow of immigrants through legal channels.
The White House's new economic report points out that about 10.5 million foreign-born people received green cards between 2001 and 2010. In absolute terms, that number is slightly above the levels of immigration at the turn of the 20th century, when there were few restrictions on newcomers so all immigrants were essentially "legal." But legal immigrants make up a far smaller proportion of the general population now than they did in the 19th century, and that percentage has actually declined in the 2000s, as the blue line in this graph shows.
That decline is not for lack of demand, judging by the long wait for visas of all kinds. So many prospective newcomers have come through without authorization instead.