In a Nutshell :  We feel pain so that we know to stop doing whatever is causing the pain.

Pain is your body’s way of signalling to your brain that it is being damaged. If something causes damage to the cells of, say, your foot, pain receptors in your foot fire off nerve signals that travel along your nerves to your brain. Your brain translates these signals into the feeling of pain, and this makes you do something to stop the pain. If the pain had started after you stepped on a very pointy rock, you might take your foot off it. Without pain, you wouldn’t know that you needed to move your foot, and so you might end up losing it, which wouldn’t do your chances of survival any good at all.

People who cannot feel pain don’t live very long. There are some conditions, such as syringomyelia, which stop the pain receptors from working properly, and as a result people don’t feel pain. This can be dangerous in lots of ways – if you don’t realise you’ve cut your foot, you won’t do anything to stop it getting infected (like keeping it clean). But the greatest danger to people who can’t feel pain is joint damage. If you hold one position for too long, your joints will start to hurt, prompting you to change position before you’ve done any damage to your joints. People with syringomyelia don’t change their position because they don’t realise they are damaging their joints, and they end up destroying them. Eventually they die of blood poisoning.