Nobody knows for certain why cats purr, but the following reasons are speculated:
Cats often purr when being petted, becoming relaxed, or when eating. Female cats are known to sometimes purr while giving birth. Domestic cats have been reported to purr when injured, sick, in pain or dying. Purring may have developed as a signalling mechanism between mother cats and nursing kittens. One theory is that it is not a sign of showing relaxation or content, but an attempt at "friendship" or a signal of "specific intent". For example, when a cat is nervous and cannot escape the situation (at a veterinarian perhaps), its purr may serve as an attempt to avoid being hurt. German ethologist and cat behaviorist Paul Leyhausen interprets it as a signal that the animal is not posing a threat.
Scientists at the University of Sussex showed in 2009 that purring, or some purring, seems to be a way for domesticated cats to signal their owners for food. According to Dr. Karen McComb and her team, purring in the "about to be fed" context has a high-frequency component not ordinarily present. Humans report feeling an urgency to investigate and satisfy the cat's needs; to wit: "feed me." However, this variety of purring seems to be found only in cats in a one-on-one relationship with their caretakers. This "soliciting purr" is different from a cat's normal purring. Another theory states that purring triggers a cat's brain to release a hormone which helps it in relaxing and acts as a pain killer. This may be a reason why cats purr when distressed or in labour.
Another theory holds that purring is beneficial to cats' health. The vibrations are thought to promote bone healing and to have the potential to dislodge hairballs from the pyloric valve.
Roger A. Caras opines that cats purr in response to profound emotions.