Slavery was replaced by wage labor because it was more productive in the long run - that's part of the economists founding narrative. But I think they tend not to emphasize that it was also simply because it was a lot more flexible for a business in a competitive market to rent than to own, ceter paribus.
Quasi-slave status persisted in many situations for a long time, being a local maxima for various management situations. Penal slaves in the postwar American South were in many cases treated worse than their chattel slave parents/grandparents partially because they were rented out by their owners, who didn't pay for them, to managers who rented and didn't have any stake in their survival.
These just-so narratives about how slavery was abolished for rational economic reasons can be quite frustrating. Obviously historically most people who owned slaves didn’t stop owning slaves because it was more profitable to give freedom and pay. Nor because they were competing with neighbors who had turned to cheaper wage labor. They did so because they were forced. Slavery was a topic of great political turmoil.
Is the argument that it would have come back if it were really cheaper? Or is the argument just so above the fray that the political turmoil is part of the supposed “costs” that were saved by abolition?
I’m not trying to directly engage the question whether slavery was more profitable than wage labor. It just always annoys me when people treat the economic forces as the ones that moved history.
The Quakers in New England in the 1800s were known for (1) being abolitionists and (2) whalers. They often bragged about employing freed and escaped slaves on their ships. It all sounds great when viewed through a narrow lens, but the whale boats had a system of paying the crew when they returned successfully. No whales, no pay. Yes, the Quakers would risk the cost of the ship and the supplies, but they didn't pay for the labor until the end ... and then only when the workers actually succeeded. The plantations had to capitalize the cost of the slaves upfront, a significant cost that often required large loans. Before the Civil War, places like New Orleans were big banking centers.
Slavery effectively disappeared in most of Christian Europe towards the end of the Middle Ages, because the Church opposed keeping Christian slaves. (Similarly, Islamic Europe had banned Muslim slaves.) As Christianity spread, slaves were no longer conveniently available, and the society had to adapt.
In densely populated areas, that meant systems like serfdom. Agricultural land was a scarce resource mostly owned by the elite. Most peasants were nominally free but tied to the land, with obligations towards whoever owned the land. Peasants farmed land owned by the local lord and paid rent with labor. And if the lord sold the land, the peasants and their obligations went with it.