The following paragraph explains it in such easy to understand terms, I am posting it in here for reference since this is a question very commonly asked:
There are several blood groups including A, B, AB, O and some others which are more rare. Blood is also either rhesus positive or rhesus negative. The rhesus type you have is dependant on the blood group of your parents. When a woman who has rhesus negative blood carries a rhesus positive pregnancy in her uterus, the blood cells from her pregnancy can enter her blood stream. Her immune system will treat the blood from the foetus as foreign and will respond by making antibodies, which will destroy the blood cells of the foetus.
By giving an injection of rhesus antibodies known as Anti-D, the woman’s immune system is prevented from making antibodies against future pregnancies. Only women who are a rhesus negative group will receive an Anti-D injection, this is given straight after an abortion or after a full term pregnancy.
Source: What does it mean if I am Rhesus Negative and what is Anti-D?