The fasting person does not invalidate his fast due to the removal of blood for the purpose of a blood test, because the doctor needs to take blood from the sick person in order to do tests on it, so this does not break the fast. It is only a small amount of blood which does not affect the body in the same way cupping does, so it does not break the fast. The fundamental principle is that the fast remains valid, and we cannot make it invalid without some legal evidence, and there is no evidence that a fasting person breaks his fast by such a small amount of blood.
But as for taking a lot of blood from a fasting person for the purpose of giving a transfusion to another person who is in need of it for example, if a large quantity of blood was taken which has the same effect on his body as cupping, then his fast will be broken thereby.
Based upon this, if the fast in an obligatory one, then it is not permissible for a person to donate this large amount of blood to anyone, unless this person to whom blood is donated is in danger and it is not possible for him to wait until after sunset. This would be if the doctors have determined that the blood of this fasting person will benefit him and remove the harm from the patient. In these circumstances, there is no objection to him donating his blood, breaking his fast, and eating and drinking, so that his strength will return to him. He must also make up for the day in which he broke his fast. And Allaah knows best.