Praise be to Allah.
It is permissible for a fasting person to take medicine by injection, whether intramuscular or intravenous , during the day in Ramadan.
However, it is not permissible for the fasting person to be given an injection for nourishment purposes during the day in Ramadan. This is because that comes under the ruling on eating and drinking; having this injection is regarded as a trick aimed at breaking one's fast in Ramadan .
If the intramuscular or intravenous injection can be given at night, that is better.
And Allah knows best.