A federal judge struck down the Defense Department’s new press policy that triggered an exodus of reporters from the Pentagon, calling it unconstitutional.