The primary cause of HDN is an immunologic reaction where the mother's immune system produces antibodies against the red blood cells of the fetus. This typically happens when an Rh-negative mother becomes sensitized to Rh-positive fetal blood cells, usually during a previous pregnancy, blood transfusion, or miscarriage.