What is Heparin injection? This medication is used to prevent and treat blood clots. It may be used to prevent and treat blood clots in the lungs/legs (including in patients with atrial fibrillation). It may be used to treat certain blood clotting disorders. It may also be used to prevent blood clots after surgery, during dialysis, during blood transfusions, when collecting blood samples, or when a person is unable to move for a long time. Heparin helps to keep blood flowing smoothly by making a certain natural substance in your body (anti-clotting protein) work better. It is known as an anticoagulant.