Tosfos asks from the Gemora in Avodah Zarah (26b) which states that it is forbidden to heal an idolater. The Gemora rules that one may not assist an idolater woman giving birth, even for payment, for she will raise the child to serve idols!?
Tosfos answers that Rav Shimi was permitted to heal the idolater, for this would help him perfect his medical skills, and thus enable him to heal other Jews.
Tosfos in Avodah Zarah adds that Rav Shimi was not an expert practitioner at all, and he was training when he cured the idolater.
Furthermore, in cases where the idolater knows that the Jew has the ability to cure him, it would be permitted to heal him, for otherwise, it would propagate hatred from them to us.
Alternatively, there may be a distinction between a child being born, who will serve idols, and one who already worships idols.
The Geresh Yerachim asks: How was Elisha permitted to heal Naaman from his leprosy?
He answers that Elisha knew that Naaman would not serve idols any longer, and therefore, it was permitted.