President Donald Trump had tried to end the program, but the court ruled Thursday that the administration had not followed the proper procedure to do so.