If they have only student visas they have to return to their country. otherwise they become illegal aliens
If a STEM Ph.D has a student visa, he just applies for a work visa.
Close to 100% of such applications are approved.
80% of STEM Ph.D graduates from China, India, Russia, and Iran are still working in the USA 5 years after receiving their degrees.
Most of those graduates are NOT elite scholars from elite schools like MIT.
They compete directly against non-elite American born scholars for exactly the same jobs.
They are willing to accept low pay, long hours, and sub-standard working conditions because they want Green Cards and US citizenship.