A federal judge agreed Thursday to block the Pentagon from punishing Democratic Sen. Mark Kelly, a former Navy pilot, for participating in a video that called on troops to resist unlawful orders.