Just because it was legal to do doesn’t mean it was right to do.
Slavery was legal.
Certain laws are as much about our morality at the time they are written.
I wonder what someone in the late 21-st century (a hundred years from now) will make of our laws today?