That people were racist towards them doesn't mean they were slaves. Pulaski was racist towards Data and McCoy towards Spock.They're kept in a storage locker, called "plastic", insulted because they're not human, etc.
You really think they were being viewed as just another worker?