This is an instance of Jevon's paradox (http://en.wikipedia.org/wiki/Jevons_paradox): making a process more efficient in terms of resource requirements (in this case labour), causes the process to become more profitable and grow, therefore using more rather than less of the resource.
The cotton gin changed that, making large-scale cotton production profitable and drastically increasing the demand for slaves (and thus creating an incentive to find justifications for and defenses of the practice of slavery).