Conservative justices poked holes in the Trump administration’s argument as the president looked on.