The 5-4 decision is a big win for the president. It rejects opponents' arguments that Congress went too far in requiring most Americans to have health insurance or pay a penalty. The court said the mandate can be construed as a tax, meaning the government can tax people for not having health insurance.
"Because the Constitution permits such a tax, it is not our role to forbid it, or to pass upon its wisdom or fairness," Chief Justice John Roberts said.
Four liberal justices, Stephen Breyer, Ruth Bader Ginsburg, Elena Kagan and Sonia Sotomayor, joined Roberts in the decision. Justices Samuel Alito, Anthony Kennedy, Antonin Scalia and Clarence Thomas dissented.
The /*Affordable Care Act*/ was signed into law on March 23, 2010 and is Mr. Obama's signature domestic legislation achievement. It has been controversial and divisive, not only among lawmakers but millions of Americans.
The court's ruling comes in the heat of the president's closely fought campaign for re-election. Mr. Obama insists it is the right thing to do and called the court's ruling a "victory for people all over the country."
What the court's ruling means
The ruling means most Americans will now have access to health insurance. People who can't afford coverage will be eligible for subsidies. It is estimated that 30 million Americans who are uninsured will get coverage, putting the coverage rate at more than nine out of every 10 eligible people.
An estimated 26 million people won't be covered. That group includes illegal immigrants, people who don't sign up for the program and choose instead to pay the federal fine and those who can't afford it even with federal subsidies.
The Supreme Court also approved parts of the health care law that crack down on insurance companies. Insurers can't limit how much policies will pay out to each person over a lifetime. Co-payments for preventative care have been eliminated. And insurance companies will no longer be able to deny coverage to people with pre-existing health problems nor can they charge those people more.
The decision also benefits certain groups. For instance, young adults can stay on their parent's insurance up to age 26. Insurers won't be allowed to charge women more for coverage, and seniors will get better Medicaid prescription coverage.
Reaction to the court's ruling
Reaction to the court's decision appears to be mixed across California. In an exclusive Eyewitness News SurveyUSA poll, Californians were asked if they agreed with the decision. Forty-four percent did, 45 percent did not, and 11 percent said they do not know enough to say.
When asked if they thought their health care would get better, 23 percent thought it would, 38 percent thought it would get worse, 34 percent thought it would stay about the same and 5 percent were not sure.
Even though the Supreme Court ruled in favor of the health care law, there is still the possibility that it could go away.
Republican presidential candidate Mitt Romney has vowed to repeal the law and replace it if he is elected in November.
"Obamacare was bad law yesterday. It's bad law today," Romney said. "Obamacare raises taxes on the American people by approximately $500 billion. Obamacare cuts Medicare...by approximately $500 billion. And even with those cuts, and tax increases, Obamacare adds trillions to our deficits and to our national debt and pushes those obligations on to coming generations."
As it stands now, the president's health care overhaul would take place in 2014. But some of the provisions of the law are already in place in California, where there are currently 7.2 million uninsured residents -- that's 19 percent of the state. If the law had been struck down, the state could've lost $15 billion in annual federal funding. California has already passed coverage for children with pre-existing conditions and young adults will be able to stay on their parents' plans until the age of 26.
ABC News and The Associated Press contributed to this report.