Yes, ninjas were allowed to marry as they needed to produce offspring. However, the oniwaban, who were ninjas in government employ, were not allowed to marry to avoid any conflicts of interest and maintain the secrecy of their missions.