The first thing to keep in mind, when discussing this quote, is that Marxist philosophy is ultimately grounded in an atheistic vision of the universe. For Marx, religion is ultimately a human invention.
The second factor to consider is the Marxist vision of society and history. For Marxists, all of human history is ultimately driven by economic factors, and by the conflict and struggle that plays out within the social and economic structures which define any society. Human civilization, for the entirety of its existence, has been grounded in inequality and exploitation, and while the particularities can differ and even the structures themselves can transform across time (for example, when the pre-industrial agrarian economy gave way to industrial capitalism), the basic problem of class conflict had remained always present.
From this, we get to Marx's famous statement: "religion is the opiate of the masses." For Marx, religion is ultimately a fiction which people have used for the purposes of alleviation. In a world driven by inequality and exploitation, people are drawn to the sense of community and comfort that religion provides, even when it is (to Marx) ultimately illusory. From that perspective, religion is pernicious to the Marxist, because the ultimate goal envisioned by the Marxists is the eventual breaking down of the Class Structure entirely, and creation of a true Classless State.