People who oppose H1B fundamentally believe that foreign workers should not be allowed to enter the American labor pool thereby depressing the wages here. Fair enough.
While on the margin, it is true that if a company can't hire a foreign worker, it _might_ be forced to hire a local worker in the short run. But in the long run, restricting labor this way only increases the chance of that job moving entirely abroad, especially for information workers like programmers.
Take this real example.
Google has offices in both Mountain View (USA) and Bengaluru (India). The hiring bar is the same and Google employees can easily transfer between offices.
A SWE in the BLR office makes ~40K USD (due to the local cost of labor), while the same SWE would make ~150K in MTV if they decided to change teams. USA gets $0 out of the 40K that the BLR SWE makes, while it would make ~55K in federal and state income taxes and even more in payroll taxes if the same person moved to MTV. And I am not even counting the sales taxes, and general velocity of the money that person would spend if they lived in MTV.
Either way for Google a SWE is a SWE and if the US made it impossible to hire them in the US, they would just increase hiring in India.
How is this a better outcome for the US or its citizens? Unless you ban all outsourcing, you are only increasing the chances of shifting the labor entirely outside the country by having strict immigration control, as opposed to labor that lives in the country and pays taxes. It's ironic that most of the H1B rage is targeted against programmers, one of the MOST remote-friendly professions as COVID lockdowns have re-affirmed. It's also ironic that there is always generic xenophobia against "second-tier programming talent from India" when Indians as a group pay the highest taxes per-capita in the US and are one of the most law-abiding.
Historically the US has had the benefit of being a desirable place to live in, due to being a developed country that largely had its shit together. That encouraged the best minds from around the world come and live here, whether researchers or working professionals, even if they had to jump several hoops to do so.
It feels like the US is extremely insistent on killing the goose that lays golden eggs. Due to the constant volatility in immigration policies, university toppers and budding researchers across the world are already wary of choosing the US as a place to work or live in. It will be a few decades before the chickens come home to roost for the US, but it will be too late by then.