Math, in so far as it is a product of consciousness, is a product of matter. There are two parts to this; firstly, the brain is a material process, and assuming that all consciousness develops from natural causes, consciousness, thought and ideas are a product of the brain. So ideas about mathamatics are products of the brain.
the second bit, is that these mathamatical ideas were not simply invented by the brain on it's own, but were developed to try to quantify and measure natural pheneomena. very basic things like "how many sheep do I have?" if you're a shepard, to "what is the circumference of the earth?" are trying to develop ideas that correspond to thinga that exist. In that sense math is a product of matter. the ideas themselves are not material.
Space is an intresting one, so I'll have quote from one of my books on this.
"Matter can move only in space and time. All bodies, including man himself, and all material processes taking place in the objectively existing world, occupy a definete place in space. They are located near or far from one another; seperated by distance; a moving body proceeds along a definete path. All this expresses the property of material things and processes known as extension.
Space is a universal mode of the existence of matter. There is not and cannot be matter without spce, just ad there cannot be space without matter. The difference between extension of an individual body and that of the whole material world is that the former is limited, finite, that is, has a beginning and an end, whereas the material world is limitless and infinite."
Marxism also uses an unusual definition of matter to get round an early scientific controversy in physics; in the early 20th century scientists realised that atoms could be broken down into energy. For a long time "matter" had been defined as being atomic in that atoms were "indivisable" and the basic component of that substance. So if atoms could be broken down further it blurred the distinction between something and nothing, leading to arguments about the "disappearance of matter". (e.g. if the majority of what makes up atoms is nothing but empty space, does that mean we are made up of nothing?) Lenin changed the definition of matter:
matter is used in its broadest sense- to denote everything that exists objectively, that is, independent of our mind and reflected in our sensations. "Matter," Lenin wrote, "is objective reality given to us in sensation."
18th and 19th century science were based on the Physics of Newton. Newtionian mechanics was supposed to be how the world worked based on predictable laws on nature, on cause and effect, that could be stated precisely in mathamatics. Our understanding of physics affects other disciplines like Chemistry and Biology as it defines the physical laws of what is possible.
Marxism shares this view that laws of nature can be used to understand everything, but says that these laws are dialectical (based on internal contradiction or change) rather than mechanical (the collision of external forces). Newtonian mechanics was still based on the view that the world was made up of permanant parts that had to be set in motion; only a 'prime mover' could create those parts and put them into motion. So it was argued that God was like a watch-maker. Marxism said, that if the universe changes itself, it does not need a designer but simply 'evolves' by wholly natural processes.
At the start of the 20th Century, Einstein came along and through a spanner in the works because he challanged the Newtionian view of physics as governed by predictable natural laws. instead we have 'indeterminist' theories such as quantum mechanics, choas theory, etc. all these undermine the notion that universe is governed by laws of cause and effect. From the marxist perspective, the breakdown in cause and effect gives room for god or some form of consciousness to create and set in motion the universe.
It has more undermined the coherence of a materialist argument for natural laws, as it roughly fits a description that something can arise from nothing, and that there are effects whih have no discernable cause. In terms of logical consistency, that leads to a cosmological argument for God as a prime mover, even if their may not be evidence to support that view.