President Barack Obama hailed the court's decision as a victory for people across America and urged opponents to rally behind the law.