Machines don't make you stop doing slavery. If anything, the forces go the other way: slavery was dying in the US at the end of the 1700s (slavery had been legal in the North too but was being abolished slowly) then the cotton gin made it suddenly hugely profitable in the South and gave it a big boost.