You are right that any foreign biological material would normally be attacked by the immune system. That is why people have treatments such as chemotherapy and radiotherapy to erradicate their own bone marrow stem cells and thus suppress their immune function before the transplant. This reduces the risk of the transplant being rejected.
Before you have a transplant, you need to get high doses of
chemotherapy and possibly radiation. This destroys the faulty stem
cells in your bone marrow. It also suppresses your body's immune
system so that it won't attack the new stem cells after the
Because the transplanted (or graft) bone marrow is now the main source of immune cells in the body, it can in fact attack elements of the person's body. This is called graft versus host disease.
Over time, the recipient’s blood cells will be replaced by those of the donor, meaning that the recipient will acquire the blood group of the donor.