Heparin is an anticoagulant found naturally in the human (and other mammal) bodies. It was first isolated from dog liver (hence the name) by Jay Maclean in 1916, who was actually searching for a procoagulant rather than an anticoagulant.
It quickly replaced hirudin, the anticoagulant present in leech saliva as the anticoagulant of choice for humans.
Still in use today, heparin continues to play an important role in anticoagulation for various conditions including pulmonary embolus, myocardial infarction and others.
Heparin is commonly given either subcutaneously as prophylaxis against deep venous thrombosis for bedbound hospital inpatients and also intravenously for full anticoagulation for whatever reason.