Eighteen states, plus the District of Columbia and San Francisco sued in federal court to block Trump’s order.