Nobody knows why cats purr, but scientists do know how cats purr. Cats purr by using their larynx and diaphragm muscles as they inhale and exhale. Many people associate purring with cats being happy, but cats have been known to purr while comforting an injured cat, which is known as purr therapy.
More remarkably is that the frequency of a cat’s purr is optimized for healing bones. Scientists even suggest that cats may purr as a way to maintain their own bone density while waiting for prey in the wild. NASA may even use purr therapy to help astronauts maintain their own bone density during long trips. Of course, it would be easier just to bring a cat with them on long space flights, but a cat might not be amused staying cooped up in a spaceship all the time.