But no one said it is was ethical in the case where it is legal, so if that was the intended question, not only is it phrased wrong but it starts from an unsupported premise, to wit, that people in the discussion believe that one is ethical and the other not.
But of course, there could be laws that prohibit linking vehicle insurance cost to gender.
My solution, when I've been married, has been having my wife get insurance, and add me as a driver. But that doesn't matter so much now that I'm older.
Edit: I do agree that discrimination by gender is fundamentally unethical.