We need to start with a review of the basic halachos of treating a non-Jew on shabbos. At this point, our assumption will be that anyone who is not Jewish would be considered a non-Jew for halachic purposes. While this may sound obvious at this point, you will soon see that it is not obvious at all. Today we will summarize the sugyah, and delineate the basic halachic opinions regarding the matter of treating a non-Jew on shabbos.
First, let us begin with the primary sources. The most important is the gemara in Avodah Zara 26a, "Rav Yosef thought to say that for a Jew (midwife) to deliver an idol worshipers baby on shabbos for pay should be permitted due to eyvah (a fear of causing hatred among non Jews towards Jews) Abaye responded, She can say to her, for us that keep shabbos we can desecrate shabbos, but for you who do not keep shabbos we do not desecrate shabbos".
There are several issues which the poskim try to clarify from this gemara, and for the sake of clarity, let me summarize the issues.
1) It seems that the maskanah of the gemara is that one is NOT allowed to treat gentiles on shabbos because of Abaye's statement that there is no Eyvah. If one were to argue that in modern times this "explanation" of Abaye won't work anymore, does Rav Yosef's heter of Eyvah still apply?
2) If Rav Yosef's heter of Eyvah applies nowadays, on what severity of issur does it apply? There are three possibilities.
a) It could be that Eyvah cannot supersede ANY prohibition, not even a rabbinic decree. If this is true, then Rav Yosef only meant that Eyvah allows one to treat a gentile at all. This would be because the gemara elsewhere prohibits a Jew from treating a gentile who worships avodah zarah. If this is true, rav yosef's heter was only meant to permit transgressing this specific decree.
b) Alternatively, it could be that Eyvah is only meant to permit transgressing Issurei Derabbanan, but not issurim of Torah origin
c) Or maybe Eyvah can even allow transgressing an issur de'oraysah.
As you can imagine, there is a lot of literature on this subject, but allow me to review the basics.
1) The Ritva and the Ran on that gemara take the position that Eyvah cannot even allow an issur derabbanan. The Bais Yosef brings a famous argument between the Ramban and Rashba vs. Rabbeinu Yonah regarding the permissibility of giving infertility treatments to a gentile. The Ramban and Rashba allowed it due to Eyvah, whereas the rabbeinu Yonah was famously very critical. It would seem that the argument revolved around the heter of Eyvah for treating a goy, but none of these authorities approved of using this heter even for issurei derabbanan.
2) Tosfos on that gemara explicitly allows the heter of eyvah for issurei derabbanan but not for issurei de'oraysah. Many acharonim seem to take up this position including the Tosfos Shabbos, and the Chassam Sofer.
3) No posek seriously entertains the possibility that eyvah would allow transgressing an issur de'Oraysah. However, several poskim, including the Maharik, and the Tiferes Yisrael cleverly use the heter of Eyvah to allow transgressing an Issur Deoraysah through an interesting "halachic trick". They use the following argument. Since the Jew is only doing the issur de'Oraysah because he is afraid of causing hatred (eyvah) that makes the melachah that he is doing an melacha she'aynah tz'richa l'gufa (work that is done for a purpose OTHER than accomplishing the work itself) . Therefore it is not really an issur deOraysah, and can be done mishum eyvah.
As we come to more modern times, there are several Poskim that must be mentioned. The Chassam Sofer (YD Siman 131) has a classic teshuva where he allows transgressing an issur deoraysah to take care of a non-Jew when there is reason to be concerned that the Jew's life would be in danger if he does not treat the Goy. This is kind of like what I sometimes call "Super-Eyvah". The Divrei Chaim of Tzanz (OC Chelek 2 Siman 25) writes, "It is the custom of (Jewish) doctors to transgress Isurei De'Oraysah on shabbos..and I heard that it was a decree of the Council of Four Lands that allowed them to do this." The obvious question is, how could the Council decide to allow an issur deroysah by decree? The answers given to this problem include the clever explanation of the Maharik, or the explanation of the Chassam Sofer of "super-eyvah".
We can't leave this part of the discussion without mentioning the Mishna Berura (Siman 120 Seif Katan 8), who sharply criticizes Jewish doctors who transgress Issurim De'oraysah while taking care of non-Jews on Shabbos. He writes "They are completely intentional transgressors of the sabbath (mechallelei Shabbos gemurim hem b'mazid) May God protect us!" So many times, a yeshiva bachur who learns the Mishna Berura and thinks he knows everything has come to me with this accusation, "haven't you seen the mishna berura! How could you...." Whatever. Tell them to go back to yeshiva and learn the sugyah properly.
To finalize this post. Virtually all important modern poskim agree (Rav Moshe Feinstein ZTL, Rav SZ Aurbach ZTL, Rav Waldenberg ZTL, Rav O Yossef Shlita and numerous others) that when push comes to shove, a Jewish physician can violate even an issur de'Oraysah to save a non-Jewish life. They come to this conclusion using some combination of the Chassam Sofer, Maharik, and Divrei Chaim. Each posek has his own stipulations etc... but the bottom line is about the same. Their advice is, try not to be there on shabbos, but if you're the only one available, do what needs to be done.
Now that we've made this clear, we can go on with our discussion in my next post. there I will tackle the following question, "If you can treat a gentile on shabbos anyway, does it really matter why you are allowed?"