Slavery was also legal not so long ago. Being gay was illegal not so long time ago. Alcohol was illegal at some point. Weed is still illegal in most places these days.
Something being a law doesn't make that something justified or moral. It just allows certain groups of people to benefit from it while lying to others that it's for their own good.
On the grounds that it's the law; those are pretty good grounds.