It rolls into a tight ball. The curl tucks the head, face, and soft underside — the parts that actually matter — into the centre, while the prickly spines are pushed outward on every side.
Those spines are the defence. They are stiff, sharp modified hairs, and a predator that bites down gets a mouthful for its trouble. The hedgehog simply waits, motionless, until the threat loses interest and leaves.