Sugarcane , produced by slave labor , drove the islands ' economy during the 18th and early 19th centuries .