This is called Nara, a type of melon found in Namibia. It grows in desert environments and has prickly thorns, small full leaves and resembles a stationary and green version of tumbling weeds from our memories of cowboy movies. Found in the African desert landscape of southern Namibia this fruit is a reserve for nutrition and can be found in the cuisine of Himba culture tradition (more on this coming soon!).
A bit on plant intelligence. It appears that when the melons are young (see top pic below), the plant equips its youthful melons with a sharp thorny thick skin so as to prevent animals from eating the fruit before it is ripe. Also when plants are thorny, it is often the case that it is warning predators of its toxic/poisonous contents (being in the unripened stage). This is in contrast to the mature adult melon in the bottom pic below which look ripe and have outgrown their thorns, having little to no thorns present.
Here is a pic of what is looks like in its environment: