Ethics: refer to a set of principles and guidelines that are established by a community, organization, or society to promote responsible and respectful behavior.
Law reflects the ethics of the populace, not the other way around.
"Ethical" is a social construct that's time-bound based upon the beliefs and actions of the people.
Slavery was ethical, for the population of slavers. The holocaust was ethical, based upon the beliefs of Nazis.
"Ethics" isn't a guideline, it's a benchmark.
History is written by the winners and we are all a product of our environment, including our time. If we were born 200 years ago in the US South, we'd be perfectly fine with slavery.
That doesn't make it right, we have a different perspective here in the present, where we understand (or at least understood) basic human rights, and that black people are, indeed, human.