A panel of appeals court judges handed the Trump administration a major legal victory in its quest to detain large swaths of immigrants living in the country illegally without bond.