Being given medicine via injection does not break the fast, whether it is intramuscular or intravenous, so long as the injected substance does not provide nutrition, because in that case it is like food and drink which are forbidden to the one who is fasting.
It says in Fataawa al-Lajnah al-Daa’imah (10/252):
It is permissible to be given medicine via injection into the muscles or veins when fasting during the day in Ramadaan. But it is not permissible for the fasting person to be given nutrients during the day in Ramadaan, because that comes under the same rulings as consuming food and drink, and this injection is regarded as a means of breaking the fast in Ramadaan. If it is possible to give the injection into a muscle or vein during the night, that is preferable. End quote.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) was asked about the spread of anaesthesia through the body – does that break the fast? And what about the flow of blood when a tooth is extracted?
Neither of these breaks the fast, but the blood that flows after removal of a tooth should not be swallowed. End quote.
Fataawa Ramadaan, p. 525
It makes no difference whether it is a local or general anaesthetic. Many of the fuqaha’ have stated that if a person who is unconscious is awake for even a moment of the day, his fast is valid, so long as he formed the intention to fast from the night before.
Imaam al-Shaafa’i said in al-Umm (8/153):
If a man loses consciousness for a day or two days during the month of Ramadaan, and he did not eat or drink anything, then he has to make up those days. But if he was awake for part of the day, then he is regarded as having fasted on that day. End quote.
Ibn Qudaamah said in al-Mughni (4/343):
If he was unconscious for the whole day and did not wake up at all, then his fast is not valid, according to the view of our imam (i.e., Imam Ahmad) and al-Shaafa’i…
If the person who was unconscious woke up for a part of the day, his fast is valid, whether that was at the beginning or the end of the day. End quote.
And Allaah knows best.