Back in the day, doctors listened to a person's heart by placing their ear on the chest with varied results. Since such a diagnosis could mean the difference between life and death, the invention of a device that could make listening to the heart more accurate became of great importance.
Rene Theophile Hyacinthe Laennec is credited with inventing the first stethoscope. It is said that he made this invention on account of the embarrassment of directly placing his ear on the chest of a female patient in order to listen to her heart. This is an excerpt from Wikipedia that describes Laennec's inspiration behind this invention: "Laennec is said to have seen schoolchildren playing with long, hollow sticks in the days leading up to his innovation. The children held their ear to one end of the stick while the opposite end was scratched with a pin, the stick transmitted and amplified the scratch. His skill as a flautist may also have inspired him. He built his first instrument as a 25 cm by 2.5 cm hollow wooden cylinder, which he later refined into three detachable parts."
The downside was it was monoaural, meaning a doctor could only listen to the heart with one ear.
An article published on blog.withings.com talks about how Irish physician Arthur Leared created a binaural version in 1851 and a more commercially viable variation that was later made by George Cammann which had "ivory earpieces and a metal tube connected to a hinge joint and elastic band."
The fact that modern stethoscopes have come a long way from the original one is explained in this excerpt from the article: "More recently, Dr. Tarke Loubani used a Littmann stethoscope as the basis of an open-source, low-cost, 3D-printed stethoscope to be used in places where medical devices are in short supply."