Morality usually comes from some sort of first principles. Some are religiously inspired, but I think it’s much better to start with one or more moral philosophers.
If we simply put it to a vote, then we would likely conclude that slavery was moral in the 18th century.