Foreign founders need to have legal status to work in the US. As of February 2020, the MIT International Student Office website has a wealth of information about immigration options for international students. Students who have not yet graduated need to consult with the ISO to see which option makes the most sense for them.
In particular, many student entrepreneurs have pursued various variants of practical training. There are several flavors, including Curricular Practical Training, Optional Practical Training and STEM Optional Practical Training. See the ISO page on this specific option here.
In addition to the OPT/ STEM OPT extension route, there is another program backed by the University of Massachusetts, called the Global EIR program in which affiliated universities hire foreign founders as "entrepreneurs in residence" and provide them with a legal status to work in the US "until they qualify for their own H1B visa".
Note that Trust Center is not equipped to provide legal or immigration advice. Please visit the ISO and talk to your advisor, or engage legal counsel who specializes in immigration issues to understand the latest rules and to interpret how these rules and policies apply to your personal situation.