In the episode "Measure of a Man" Data is granted human rights. What would the punishment be for enslaving an Android?
It seems likely that enslaving a free android would be treated, from a legal perspective, in precisely the same way that you would treat the enslavement of any other sentient species; that it would be illegal under both Federation law and punishable by imprisonment and rehabilitation according to the local laws of the planet that you're on. Since Federation planets have to accept the fundamental rights of the individual (including those individuals deemed to be sentient by the Federation), there must by definition be strict local laws against abduction and slavery, sufficient to deter these things from taking place.
In TNG: The Most Toys, Kivas Fajo abducts Data and attempts to keep him for his own amusement. Ultimately he's charged with kidnapping, an offense that seems to occasion what we can assume is going to be a lengthy jail term.
Allowing the keeping of slaves (of any description) would immediately negate your Federation membership.
Lack of any kind of slavery is a basic requirement for any world to be even considered for Federation membership, so the notion that we should trade with a nation that has a population that is ninety percent slaves is abhorrent.