1. Getting skilled talent from overseas. You simply can't get enough of these people locally. These go to Amazon, Microsoft, Google, Facebook, etc;
2. Cheap labour for bodyshops.
The problem here isn't (1) but (2). IMHO the problem has two primary causes:
1. Prevailing wage determinations are a joke; and
2. Lack of mobility, particularly the essentially indentured servitude system that is employer sponsored permanent residency.
The last is particularly important. The queue for green cards is based on country of birth and some countries have deep queues, particularly China, India, the Phillipines and Mexico.
The way it works is you can have a 3 year H1B twice for a total of 6 years. If your employer starts the green card sponsorship at least a year before your (final) H1B expires you can stay indefinitely. You cannot then move employers or, to some degree, have significant changes in job responsibilities. You can't move (geographically) either.
Green card sponsorship works in essentially two phases.
The first is LC (labor certification). This is where the queue and per-country quotas exist. Depending on category, if you're from India you might be waiting 5-7+ years for this.
The second phase is essentially automatic and takes 6-12 months.
Now the LC phase has some huge variables. You can get randomly audited (DOL estimates 30% of LC applications will be audited and they randomly audit some so employers don't game the system, so they claim). Those audits can lead to further questions. This cycle can (and does) continue for years in some cases.
All this time the employee simply cannot move and has absolutely no bargaining power with their employer.
The solution here is to give employees mobility and make green cards essentially automatic after a given period of employment, combined with no limits on H1B renewal. If you still want a per-country quota (and that sounds like something the US would continue to want), then after, say, 3-5 years on work visa you automatically enter the queue for permanent residency and when your number comes up, you just get it.
Fact is, many foreigners are willing to work for essentially slave wages in the hopes of a better life for them and their children. The current system isn't slavery in the classic sense but I'd certainly call it indentured servitude.
As for the idea that "they're stealing our jobs" [tm], let me just add my personal perspective as someone who's interviewed:
There are many people out there masquerading as programmers/engineers who have utterly no business drawing a paycheck for such. I'd even go so far as to say the majority. People who can actually program are in high demand, regardless of country of origin and they're simply aren't enough of them. Employing them from overseas does not (IMHO) hurt local talent. Demand exceeds supply.
Even bodyshops are a symptom. Many companies, particularly Fortune 500 companies and governments at every level, are willing to accept high-priced inccompetence-to-mediocrity that is the norm for "consultants" and vendors.
This isn't a zero sum games.
The real long term danger is that the US, as a whole, seems to take their preeminence in technology as a given. At some point you'll reach a tipping point where it just makes sense to invest in technology elsewhere. We're not there yet. Far from it. But it could happen.
In 1800 the US had a population of ~2M. In 1900 it was ~50M. In those 100 years the US transformed from an agrarian backwater to an industrial superpower largely on the back of immigration.
I understand the desire to shut the doors. This is pervasive at every level from immigration to the ridiculous NIMBYism that is rampant in the Bay Area. It's ultimately short-sighted however.