Post number 2 makes a great point, Communism is a form of economic system. However, most people probably think of it as a form of government. As far as was it inevitable I would say that some form of new economic system was inevitable.
Inevitable seems like an unusual word to use in reference to an economic system. Is/was it inevitable that people would be searching for a better way to distribute wealth and solve economic inequalities? Yes likely. But it did not have to be communism. There will always be people in any society who are unhappy with the economic system they live under and therefore looking for a new one. I agree with pohnpei that there seem to be a limited number of ways we can change our economic systems, at least at the most basic level.
I don't see where any particular type of governmental/economic system is inevitable. However, there are only so many different ways that human societies and economies can be set up. Looked at in that way, you might argue that it was inevitable that someone would come up with the idea of communism. The fact that many different people came up with relatively similar ideas means that there must be something that pushed people towards that idea as well.
I do not think that communism was inevitable; it was rather a utopian social scheme similar to many that were popular in the mid nineteenth century. As the previous post points out, the society it hoped to create was quite utopian where no government was needed and class did not exist. As with many utopian movements, it was a reaction to a series of events in history with undesirable results, in this case the Industrial Revolution. Karl Marx anticipated that the Communist Revolution would occur in England, where the Industrial Revolution had begun. It did not happen there of course, to Marx's great disappointment; but rather occurred in Russia, the last place he ever expected it to happen. In that country there was a perfect storm of a backward and corrupt government system and a brilliant political leader who espoused Marx's ideas. Communism's success in the Soviet Union was an aberration that took root and spread like a religion. Had Russia been less backward, more responsive to the needs of the masses as was the case in England, communism would not have flourished. It rather would have been a curiosity among sociologists. It is no small wonder that it was nothing more than a social experiment that ultimately failed. Remember, utopia literally means "nowhere."
Let's be clear - communism is an primarily an economic system, not a type of government. The goal of communism is
a classless and stateless society structured upon common ownership of the means of production, free access to articles of consumption, the end of wage labour and private property in the means of production and real estate.
In its pure state, these are arguably very desirable goals. If all persons could obtain whatever they needed to sustain themselves without harming others and if society could end the divisions between socioeconomic classes, many of the conflicts and problems of contemporary society would be resolved. Those who labor to bring about communist systems of directing the economic and political organizations of countries often are sincerely doing so out of a belief that this will be the best structure for the majority of the citizens. From that viewpoint, the attempt to develop communism probably was inevitable.
Because of the way in which many people think and react, however, the successful establishment of pure communism has proven to be enormously difficult. As a species, human beings seem to be motivated by personal rather than group needs, taking pride and motivation from individual accomplishments in preference to deferring to the good of the whole. These tendencies fly in the face of the communist philosophy, and make the establishment of a successful purely communist system difficult if not impossible.