Yes, ninja were of course allowed to marry, as they needed to produce offspring. However, the oniwaban, who were ninja in government employ during the Edo period, had restrictions applied to contact with outsiders and could only marry within their profession.