The move is intended to dissuade Central American migrants from making the long, dangerous journey through Mexico. It is expected to be challenged in court.