The nation's highest court preserved the landmark law, formally called the Affordable Care Act (ACA), for the third time since its 2010 enactment, declaring that Texas and other challengers had no legal standing to file their lawsuit seeking to nullify it.
Shares of health insurers Centene Corp and Molina Healthcare Inc, which participate in the exchanges to buy individual health insurance set up by the law, closed up more than 2% on Thursday.
In February, CVS Health Corp said it would return to selling individual health insurance plans on the online marketplaces created by the ACA, saying the market had stabilized.
"We look forward to bringing innovative solutions and more options to the marketplace as we enter the exchanges in 2022," it said on Thursday.
CVS Health's Aetna insurance unit and other large health insurers such as UnitedHealth Group Inc exited these online exchanges in 2017 and 2018, due to financial losses and uncertainty as Republicans tried to repeal the law.
Morningstar analyst Julie Utterback said the Supreme court decision, although largely expected, alleviated uncertainty about the individual exchanges and expansion of the Medicaid health program for low-income Americans.
"We think CVS and other insurers are primarily being attracted to the individual exchanges and other ACA-related initiatives because of the prospects of more individuals being drawn to the market through steps that the Democrat-controlled federal government is taking to expand access to health insurance," Utterback said.
If Obamacare had been struck down, up to 20 million Americans stood to lose medical insurance, cutting revenue for some doctors and hospitals, and insurers again could have refused to cover people with pre-existing medical conditions.
Advocacy group America's Health Insurance Plans said "Americans agree we should continue to build on the ACA," while the American Medical Association said it would continue to work for expanded healthcare access.
"We still expect Democrats to pass permanent expansion of exchange subsidies," Evercore ISI analyst Michael Newshel said in a note, calling the decision a relief for Republicans, as shifting politics had made the lawsuit a liability.
(Reporting by Ankur Banerjee, Amruta Khandekar in Bengaluru; editing by Peter Henderson and Jonathan Oatis)