The idea that consciousness is derived from material conditions appears in The German Ideology, a set of essays that Karl Marx and Friedrich Engels wrote in 1845–1846. The collection was not published until 1932, however. The relationship between material conditions and consciousness is further developed in subsequent works that Marx wrote on his own and together with Engels.
In The German Ideology essays, as they argue for materialism as the major factor in forming consciousness, Marx and Engels are directly challenging dominant philosophical positions that had been developing since the late eighteenth century. In particular, they take issue with the idealism associated with Georg Wilhelm Friedrich Hegel, which they refer to as the “illusions of German ideology.” In the idealist view, which is strongly connected to liberalism, human consciousness is the motor for social and political development.
The Marxist argument is based on the idea that human beings cannot separate themselves from their environment and real action. “Men” (that is, human beings) have consciousness, which distinguishes them from animals; this distinction originates when
they begin to produce their means of subsistence, a step which is conditioned by their physical organisation. By producing their means of subsistence men are indirectly producing their actual material life.
Consciousness—including religion, metaphysics, and every aspect of ideology—does not arise in a vacuum. Rather, as men develop
their material production and their material intercourse, [they] alter, along with their real existence, their thinking and the products of their collective thinking. Life is not determined by consciousness but consciousness by life.
Marx continued to refine his "materialist conception of history," constantly reaffirming material conditions of production as the driving force. This body of theory is often referred to as “historical materialism.”