Goose bumps, as you might know, are bumps which develop at the base of body hairs when a person is cold or experiences a strong emotion such as fear or euphoria. What happens is that an involuntary discharge of the stress hormone adrenaline from the nervous system causes the hair follicles to elevate above the rest of the skin and appear as goose bumps. The reflex of producing goose bumps and rising up of hairs is known as piloerection. It also occurs in many other mammals, most noticeably in porcupines and cats.
I am sure you know that air acts as a great insulator. So when it is cold, the rising hairs trap air around the body, thus creating insulation and keeping the body warm.
WHY DO WE GET GOOSE BUMPS WHEN WE ARE SCARED?
The reason behind this is, “when you are going to be attacked, try to look as big as possible.” In prehistoric times, when man was more hairy, the rising up of air made him look much larger. This mechanism was used to intimidate enemies when under threat. Although humans have stopped living in the wild and have far less hair now, our system still releases that hormone in response to fear. And that is why we get goose bumps when we are scared. Many animals still find piloerection useful when they are threatened; common examples being sea otters and porcupines.