The Ben Ish Hai (Rav Yosef Haim of Baghdad, 1833-1909), in Parashat Balak (1), discusses the Halachot relevant to the prohibition against drinking the wine of non-Jews (listen to audio recording for precise citation). He writes that according to Torah law, the only wine that is forbidden is Yayin Nesech, meaning, wine that was used as part of an idolatrous religious service. The Torah compares wine poured for a pagan deity to a pagan sacrifice, and it is therefore forbidden just like something that was offered as a sacrifice to an idol. The Ben Ish Hai emphasizes that Yayin Nesech is forbidden both for drinking and for any other kind of benefit.
The Sages, however, expanded this prohibition to include Setam Yenam, any wine owned by gentiles. Furthermore, they forbade even Jewish wine that was touched by a gentile. The reason given for these enactments is that the Sages wanted to prevent Jewish men from engaging in close social contact with gentile women, which could lead to promiscuity or even intermarriage. However, the Ben Ish Hai writes, this is not the primary reason for the prohibition of Setam Yenam. The real reason, he asserts, involves deep Kabbalistic concepts that the Sages understood with their keen spiritual insight. According to Kabbalistic teaching, there is something inherent in the wine of non-Jews that renders it forbidden for Jews, and this is the primary reason for the prohibition. The Sages chose not to disclose the Kabbalistic origins of this Halacha, and so they instead gave a simple reason that even the unlearned masses could understand – the interest in avoiding close social contact with gentile women.
For this reason, the Ben Ish Hai adds, the prohibition of Setam Yanam will always apply, even if the stated reason becomes irrelevant. If, at some point, circumstances arise that obviate the concern of close social contact, it would nevertheless still be forbidden to partake of the wine of non-Jews.
The prohibition of Setam Yenam applies to both drinking and deriving other kinds of benefit from the wine of non-Jews. However, when it comes to non-Jews who are not idolaters, their wine – or the wine of Jews that they touch – is forbidden only for drinking. Other forms of benefit are not forbidden unless the gentile who owns or touched the wine worships idols. Accordingly, the Ben Ish Hai writes, it is permissible to derive benefit from the wine of Moslems, who, as the Rambam (Rabbi Moshe Maimonides, Spain-Egypt, 1135-1204) ruled in one of his responsa, are not considered idolaters. Moslems believe in a single Creator, and are therefore not considered idolaters. Wine that they own or touched is thus forbidden only for drinking; other forms of benefit are permissible. The Ben Ish Hai notes that this is also the position taken by the Arizal (Rav Yishak Luria of Safed, 1534-1572).
The Ben Ish Hai discusses in this context the status of non-Jews who bow before articles in their houses of worship, and notes that they are considered idolaters, and their wine is forbidden for any kind of benefit. The concept of God’s unity in their thought is not pure unity, and rather constitutes “Shituf” (the belief in a “partnership” of deities), and they are thus considered idolaters with respect to the laws of Setam Yenam. Therefore, all kinds of benefit are forbidden from wine owned or touched by a believing idolaters.
The Ben Ish Hai in this context emphasizes the severity of this prohibition against partaking of the wine of gentiles. He makes reference to work on this topic called Yayin Ha’meshumar, a 19th-century work by Rav Natan Shapiro, and says that a person’s “hair stands up” when he reads in this book of the unique gravity of this prohibition. The Ben Ish Hai also mentions the work “Ayuma Ka’nidgalot” which (on p. 24) tells a frightening story of the grave consequences of violating this Halacha. This prohibition is so severe, the Ben Ish Hai writes, that a person who violates this law “uproots his soul from the place where it is rooted, and he has no share in the world to come.” Furthermore, there are some authorities who maintain that a person must avoid the wine of non-Jews even at the risk of death. According to this view, if a doctor advises a Jewish patient that he must drink a certain wine to save his life, he should surrender his life rather than drink the wine. It does not appear that Halacha follows this opinion, but the fact that some authorities issued such a ruling demonstrates the severity with which this prohibition is treated.
Summary: It is forbidden to drink wine that is owned by a non-Jew, or that was touched by a non-Jew. If the non-Jew is somebody who has the status as an idolater – such as one who bows before an article in their house of worship – then the wine is forbidden for drinking and for any other kind of benefit.