New Zealand's defence minister has condemned online abuse towards the female captain of a navy ship that sank at the weekend.