Cactus stems are thick because that’s where they store water when it rains.
The cactus spines protect the cactus from predators, reduce water loss, provide shade and regulate temperature, and even help the plant reproduce.
The roots of a cactus absorb water like all plants however instead of growing deep in the ground they grow just below the surface and extend out several feet from the plant to absorb as much water as possible.