WASHINGTON—Justices on the Supreme Court were sharply divided on several aspects of President Barack Obama’s executive amnesty, but it’s very likely that the 26 states challenging Obama’s program will prevail, ending the president’s gambit to grant legal status to 4.5 million illegal aliens.