And what does that have to do with it?
“Law” is not always a reference for what is right or what is wrong.
Some years ago it was legal to have slaves... and even today, there are still countries that state as illegal for women to get school education.
But that doesn’t mean these are correct.