When read in context Karl Marx was not directly attacking religion when he wrote those famous words.
- Religious distress is at the same time the expression of real distress and the protest against real distress. Religion is the sigh of the oppressed creature, the heart of a heartless world, just as it is the spirit of a spiritless situation. It is the opium of the people. The abolition of religion as the illusory happiness of the people is required for their real happiness. The demand to give up the illusion about its condition is the demand to give up a condition which needs illusions. Karl Marx - Critique of Hegel’s Philosophy of Right
To Marx, religion was not the problem but rather a human response to the more fundamental problem of an oppressive economic system. Just as opium dulls the pain of a sick person so too religion soothes emotional pain and reassures the suffering with illusionary promises of a better place to come.
These words of Marx are a critique of a heartless world that makes religion appealing. When he called for the abolition of religion it was a call to take away the analgesic effects of its false hope and to change the conditions that make it desirable.
I am not writing this in defence of Marxism but I thought it interesting to consider the true intent of this famous quote, and to reflect that religion does indeed provide the ultimate motive for society to remain apathetic in the face of injustice in this life.
As hymn writer William Henry Monk put it in my least favourite hymn, "All Things Bright and Beautiful"