With sweet gums, "the distinctive compound fruit is hard, dry and globose, 1 to 1.5 inches in diameter, composed of numerous (40-60) capsules. Each capsule, containing one to two small seeds, has a pair of terminal spikes (for a total of 80-120 spikes). When the fruit opens and the seeds are released, each capsule is associated with a small hole (40-60 of these) in the compound fruit. Fallen, opened fruits are often abundant beneath the trees; these have been popularly nicknamed "burr balls."
OK. That's the technical definition from wiki. To me, they have always looked like spiked maces or morning stars, the flails used by knights back when hand-to-hand combat was up-close and highly brutal. But why?
I have to assume that the spikes are to protect the tree's precious seeds from birds like the seed-eating finches that have never heard of middle-age weaponry or be intimidated by such. Over the millennia, these birds have evolved their own methods of dealing with the formidable defenses; they're well equipped with pointed bills and the necessary dexterity to remove seeds from difficult places.