Judge says administration must give migrants opportunity to express concerns about safety of deportation destinations.