A purr or whirr is a tonal fluttering sound made by some species of felids, including both larger, wild cats and the domestic cat (Felis catus), as well as two species of genets and the Caquet titi monkey (Plecturocebus caquetensis).
Purring has been linked to lowering stress, decreasing anxiety and even strengthening bones and repairing muscles of HUMANS AND CATS.
Cats and kittens rarely purr when they are alone. Purrs are aimed at other cats or people. The purr has been described as the feline equivalent to a smile, which makes great sense.

What makes the purr interesting is that it is different from other cat vocalizations. A purr is produced during the entire respiratory cycle (inhaling and exhaling). Other vocalizations such as the meow are limited to the expiration of the breath, much like a human when we speak.

Furthermore, visual representations like the one above help us fully grasp the concept of Cat Purring When Hurt.
The functions of purring. A purring cat is generally seen as comfortable, and happy with their lot in life. This is true, and a purr can certainly be a sign of contentment. However, there are also some lesser-known reasons behind the humble purr.
Do cats purr when they are sick? Sick cats often lie quietly in a hunched position. They may be purring, which cats do not only when they're happy, but also when they're sick or in pain. A cat with breathing difficulties may refuse to lie on his side and may keep his head raised.
Library of Congress: Why and How Do Cats Purr?