Having a blood sample taken for testing does not invalidate the fast
That does not affect the fast because it is a little and does not make the fasting person weak.
Shaykh Ibn Baaz was asked about the ruling on a person who has blood taken when he is fasting in Ramadaan for the purpose of testing.
He replied:
A test of this nature does not affect the fast, rather it is excused, because it is something needed, and it is not like the things that are known to break the fast according to sharee’ah.
Majmoo’ Fataawa Ibn Baaz, 15/274.
Shaykh Ibn ‘Uthaymeen was asked in Fataawa Arkaan al-Islam, p. 478, about the ruling on a fasting person having a blood test, and whether that breaks the fast.
He replied:
The fasting person does not break the fast by having blood taken for a test. If the doctor needs to take blood from the patient to test it, this does not break the fast, because it is a small amount of blood and it does not affect the body in the way that cupping does. The basic principle is that the fast remains valid and cannot be spoiled except by things for which there is shar’i evidence that they affect the fast. In this case there is no evidence that the fasting person breaks his fast because of this small amount of blood. With regard to taking a large amount of blood from a fasting person in order to donate it to a person who needs it, for example, then if a large amount of blood is taken which has the same effect on the body as cupping, this does break the fast. Based on this, if the fast is obligatory then it is not permissible for anyone to donate a large amount of blood to anyone, unless the person who is to receive that blood is in dire need and cannot wait until after the sun sets, and the doctors have decided that the blood of this fasting person will benefit him and will meet his immediate need for it. In this case there is nothing wrong with donating blood, and he may break his fast and eat and drink in order to regain his strength, and he should make up this day when he broke his fast.