That would be because "illegal" immigration is less than 100 years old.
Before the 1920's, any able bodied person could enter the country, unless they were Chinese. This was due to the Chinese Exclusion Act of 1882 which also prohibited “any convict, lunatic, idiot, or any person unable to take care of himself or herself without becoming a public charge.” The first real test for immigrants came in 1917 which was a literacy test that could be taken in the immigrants native language. It wasn't until 1921 that Congress put immigration quotas in place.
Think your immigrant ancestors came here legally? Think again | Opinion - nj.com
What's interesting is the same arguments against immigrants a century ago are the same ones we hear today, only then it was Italians, Greeks, Jews, and the Irish that some had an issue with.
Excerpts from the Congressional Debate on Immigration Restriction (1921)
“I would like to shut for a time the immigration door. Thousands come here who never take the oath to support our Constitution and to become citizens of the United States . . . They fill places that belong to the loyal wage-earning citizens of America. They preach a doctrine that is dangerous and deadly to our institutions. They are no of service whatever to our people. They constitute a menace and danger to us every day.” -- James Thomas Heflin, From Alabama
“Practically all of them were weak, small of stature, poorly clad, emaciated . . . It is for this reason that I say the class of immigrants coming to the shores of the United States at this time are not the kind of people we want as citizens in this country.” -- Representative James V. McClintic, Democrat from Oklahoma,
“We should stop immigration entirely until such a time as we can amend our immigration laws and so write them that hereafter no one shall be admitted except he be in full sympathy with our Constitution and laws, willing to declare himself obedient to our flag, and willing to release himself form any obligations he may owe to the flag of the country from which he came . . . within a few short years the damage will have been done. The endless tide of immigration will have filled our country with a foreign and unsympathetic element. Those who are out of sympathy with our Constitution and the spirit of our Government will be here in large numbers, and the true spirit of Americanism left us by our fathers will gradually become poisoned by this uncertain element.” -- Representative Lucian Walton, Democrat from Texas
What the speaker below says is just as true today as it was then:
"Defenders of this bill thoughtlessly repeat the exploded theory that there have been two periods of immigration, the good period, which the chairman of the committee fixes up to the year 1900, and the bad period since. The strange thing about it is that at no time in history has any country made such rapid progress in industry, in science, and in the sphere of local legislation as this country has shown since 1900. To prevent immigration means to cripple the United States. Our most developed industrial States are those which have the largest immigration. Our most backward States industrially and in the point of literacy are those which have no immigration to speak of... The extraordinary and unprecedented growth of the United States is as much a cause as the effect of immigration. The new immigration is neither different nor worse, and besides that, identically the same arguments were used against the old immigration." -- Mr. Meyer London, Socialist-N.Y.
Even long before the 1920's Ben Franklin was against German immigration:
"Why should Pennsylvania, founded by the English, become a Colony of Aliens, who will shortly be so numerous as to Germanize us instead of our Anglifying them, and will never adopt our Language or Customs any more than they can acquire our Complexion?
Which leads me to add one Remark, that the Number of purely white People in the World is proportionably very small. All Africa is black or tawny; Asia chiefly tawny; America (exclusive of the new Comers) wholly so. And in Europe, the Spaniards, Italians, French, Russians, and Swedes, are generally of what we call a swarthy Complexion; as are the Germans also, the Saxons only excepted, who, with the English, make the principal Body of White People on the Face of the Earth. I could wish their Numbers were increased." -- Benjamin Franklin, in 1751
Not many Americans reading this thread today would have even been born if the laws we have today were in place when their ancestors arrived in the US.