Answer:
No, he didn't. He's misquoted saying that, "Religion is the opiate of the people."
The actual quotation is, "Religion is the sign of the oppressed creature, the heart of a heartless world and the soul of soulless conditions. It is the opium of the people."
Anyways, the meaning behind this quotation is the fact that he expresses that religion is an escape for people's emotions and to work towards a specific goal. For example, opium of the people describes a way to escape the harsh realities of our society and human nature. To be happy through an illusion as you could say, back in the time that Karl Marx made this statement, opium was used as a sedative, painkiller, so the definition of this quotation can have many different meanings.