The leaves are the spines
Why Does a Cactus Have Spines Instead of Leaves?
A cactus did not lose its leaves. It turned them into needles, and gave the leaf's job to its stem.
-
Step 1 of 5
A leaf has to be leaky to work at all.
It must open tiny holes to let in the air it feeds on. Water escapes through those same holes, and a big flat leaf loses a great deal of it.
-
Step 2 of 5
In a desert that bargain stops being worth it.
Where rain comes a few times a year, a plant covered in wide leaves would empty itself. Something had to give, and it was the leaves.
-
Step 3 of 5
So the leaves shrank all the way down to spines.
A cactus spine is a leaf. It has no holes, no surface worth speaking of, and loses essentially no water at all.
-
Step 4 of 5
The stem took over the feeding.
That is why a cactus is green. The thick stem does the job the leaves used to, behind a waxy skin with far fewer holes, and it opens them at night.
-
Step 5 of 5
And the spines turned out to be useful in their own right.
They shade the surface, break up drying wind, catch dew that drips to the roots, and make the plant a bad idea to bite.
The stem is pleated like a concertina, so it can swell after rain and shrink again through the dry months without splitting.
The short version
A cactus turned its leaves into spines to stop losing water, and handed the job of feeding the plant over to its thick green stem.
Try it yourself
Leave a slice of apple and a whole apple out for a day. The wide cut face shrivels; the small skin-covered surface barely changes.