I think that their primary purpose is to depress wages through labor arbitrage.
That being said, the visa does have a path to permanent residency and Donald Trump is looking at making this a truly sadistic process:
The Department of Homeland Security is considering new regulations that would prevent H-1B visa extensions, according to two U.S. sources briefed on the proposal. The measure potentially could stop hundreds of thousands of foreign workers from keeping their H-1B visas while their green card applications are pending.
The proposal, being drafted in memos shared between DHS department heads, is part of President Donald Trump’s “Buy American, Hire American” initiative promised during the 2016 campaign.
The administration is specifically looking at whether it can reinterpret the “may grant” language of the American Competitiveness in the 21st Century Act to stop making the extensions. The act currently allows the administration to extend the H-1B visas for thousands of immigrants, predominantly Indian immigrants, beyond the allowed two three-year terms if a green card is pending.
“The idea is to create a sort of ‘self- deportation’ of hundreds of thousands of Indian tech workers in the United States to open up those jobs for Americans,” said a U.S. source briefed by Homeland Security officials.
The problem with H-1B visas is not the (usually) South Asian programmers, it’s Google, and Facebook, and Tata, and Infosys, and IBM, not the poor schlubs who work under near slavery conditions for those companies.