To address the original topic - For robots which are clearly intelligent, sentient, and self-aware, then I would say it is morally clear that they should have rights and not be slaves. If the robots are clearly only animal intelligence or not self-aware, then they shouldn't.
That said, lots of science fiction is set in dystopian futures where slavery exists - i.e. humans are enslaved by uplifted apes, or uplifted apes are enslaved by humans, or genetically inferior people are enslaved, or what have you.
Mechanicals will have not ethical issues with enslavement of biologicals either.
I think the real issue with robots and androids isn't there sentience, it's how they are portrayed as inherently physical superior to humans. It seems to be forgotten that the same material tech that would allow for such strong and compact robots and androids could easily be made into an exoskeleton or suit for humans. It presumes humans won't enhance themselves mentally and physically in other ways.
I don't think that's a particularly broad assumption in science fiction. For example, in Star Wars you have both droids that are not physically superior to humans (like C3-PO) and biologicals that are enhanced (like General Grievous). Of course, not all robots and not all biologicals will be equally enhanced - which is reasonable.
The annoying part for me in Star Wars is that slavery isn't even questioned. No one in the setting appears to be abolitionists trying to stop the practice of slavery, which is widespread even for biologicals.