New York City officials announced a pilot program on Thursday to deploy portable gun scanners in the subway system, part of an effort to deter violence underground and to make the system feel safer.