Marx posited that the industrial revolution fundamentally changed the relationship between worker and output, or the end result of their work, thus alienating them from their work, their community, and ultimately, themselves. He saw feudalism as a precursor to industrialized capitalism.
In addition, the forces of industrialism created huge gaps in wealth distribution, with a few winners (the factory owners) and a lot of losers (the workers, also called the Proletariat). Marx acknowledged that a middle class did exist but believed it was declining as the chasm between rich and poor widened. He saw the middle class as essentially unsustainable.
Marx saw capitalism as exploitative and limited. It couldn't last, because of the decay of the middle class as they moved either into the "bourgeoisie" (leisured, upper class) or the Proletariat (poor, working class).
He assumed that, under these conditions of collapsing capitalism and emerging communism, the state (centralized government) would fade or wither away. Without a centralized state, a series of small communities would need to share work and wealth—hence the rise of communism, or a network of communities sharing resources.
Communism is based on the principle of cooperative work, and as an experiment was implemented in the Union of Soviet Socialist Republics (USSR) and Cuba in the 1920s through 1980s.
Instead of the state withering away, in the USSR, its power was reinforced in trying to implement a communist system of collective farms. The shared workload demotivated individuals from achievement (because they were separated from the product of their own work, ironically) and led to other problems: notably, a distrust of the state and a general lack of engagement with both the political process and the economic system itself.
The experiment in the USSR failed because of how overbearing the state became. Instead of withering away, government power became even more centralized. Cooperatives didn't work on a large scale.
Marx's alternative to capitalism was communism, which he argued was a natural process as a result of the inevitable collapse of capitalism. Since, in the USSR, capitalism didn't "naturally" decline, it's hard to say if he was entirely wrong. On a small scale, communist principles do work, such as in kibbutz farms. Socialism, such as practiced in some European countries, has worked well in terms of stabilizing society and narrowing the gaps between rich and poor.
Marx's belief in the inevitable failure of capitalism may be correct, although environmental forces and the emergence of new technology could play roles we do not yet understand.