This is one of those laws that's kind of like speeding in cars. To actually enforce it 100% of the time would require the sort of enforcement that people would not be very happy with. With immigration, it'd mean living in a "papers, please" kind of country. The best way to deal with immigration is to make it cheap, legal and easy for people who just want to work:
http://www.nytimes.com/2016/10/26/business/economy/if-immigr...
No one would walk miles through the Arizona desert if it were easy to do things legitimately - the only people sneaking around would be actual criminals.
And of course this one is a classic:
http://johnhcochrane.blogspot.com/2014/06/the-optimal-number...