Many Halachic authorities grappled with the well-known question as to how many days of Yom Tob one should observe if he visits Israel for the holidays and plans to return home. Does he observe one day, like permanent Israeli residents do, or does he observe two days, like he does back home in the Diaspora?
This question was addressed by Rav Yosef Karo – "Maran," author of the Shulhan Aruch – in his work of responsa, Abkat Rochel (106). Maran writes unequivocally that a person in this case observes two days of Yom Tob, like he would back home, and Maran adds that this was, in fact, the practice in his time. Visitors from abroad would observe two days of Yom Tob, and would have Minyanim on the second day with Hallel, Torah reading and Musaf.
The Hacham Sevi (Rav Sevi Ashkenazi, 1656-1718) famously argued, and contended that the visitor in such a case observes only one day of Yom Tob, like the permanent residents of Israel. He acknowledges that one might seek to challenge his position based on the Mishna’s ruling in Masechet Pesahim that if one temporarily visits a community that follows different customs than those followed in his own community, he must continue observing the stringencies followed in his home community. Seemingly, this should apply to visitors in Israel for Yom Tob from abroad, such that they would be required to observe the stringency of a two-day Yom Tob celebration even when visiting Israel, where only one day is celebrated. However, the Hacham Sevi contended that the case of Yom Tob differs from the situation addressed by the Mishna in Masechet Pesahim. There, the discussion pertains to a stringency which the visitor could, conceivably, continue observing in his new location even if he decided to remain there permanently. The Mishna there addresses the example of the custom which was observed in some communities to refrain from work even on the morning of Ereb Pesah. One whose community follows this custom is required to do so even if he spends Ereb Pesah in a community where this custom is not observed, because even if he would decide to remain there permanently, he could, if he so wished, continue observing this stringency. This is not the case when it comes to the second day of Yom Tob. If a visitor from abroad decided to settle permanently in Israel, it would then be forbidden for him to celebrate two days of Yom Tob, due to the prohibition of "Bal Tosif" (adding onto Misvot). When it comes to this custom, then, a visitor does not follow the stringency of his home community when visiting a community where this stringency is not observed. Therefore, visitors from the Diaspora should not, according to the Hacham Sevi, observe the second day of Yom Tob in Israel.
Generally, of course, we follow the Halachic rulings of Maran, and so it seems clear – at first glance – that in this instance, too, we should accept Maran’s position and require visitors from abroad to celebrate two days of Yom Tob in Israel. However, Rav Shmuel Salant (1816-1909) noted that Maran does not address this case in the Shulhan Aruch. (Interestingly, he does speak of the reverse case, where an Israeli resident spends Yom Tob in a Diaspora community.) Rav Salant viewed this omission as reflecting Maran’s changing his stance, his retraction of the ruling he wrote in Abkat Rochel. According to Rav Salant, even Maran followed the view of the Hacham Sevi, that visitors in Israel observe just one day of Yom Tob.
Hacham Ovadia Yosef disagrees, arguing that the omission of this case from the Shulhan Aruch in no way indicates a retraction. Maran generally brings in the Shulhan Aruch only those rulings found in the Rambam’s work and in the Tur, and therefore, the omission of the Shulhan Aruch’s ruling regarding the case of visitors spending Yom Tob in Israel does not mean he retracted this ruling. In Hacham Ovadia’s view, then, visitors who spend Yom Tob in Israel must observe two days.
Hacham Ovadia goes so far as to say that if a visitor in this case mistakenly recited a weekday prayer on the second day of Yom Tob, he must then recite the Yom Tob prayer. We might have assumed that this case falls under the category of "Safek Berachot," where there is uncertainty as to whether the Berachot of the Amida prayer should be recited. After all, according to the Hacham Sevi, this individual has fulfilled his prayer obligation, and thus we should, seemingly, consider this a situation of "Safek Berachot," where the requirement to recite Berachot is subject to a Halachic debate. And, of course, in situations of "Safek Berachot," we do not recite the Beracha or Berachot in question. However, Hacham Ovadia maintains that the case under discussion is not considered a situation of "Safek Berachot," because Maran observed the custom in Israel in his time that visitors observed two days of Yom Tob. When there is an established custom, Hacham Ovadia writes, then we ignore Halachic rulings in opposition to the custom, to the extent that there is not even any doubt. As such, Halacha conclusively follows the opinion that visitors in Israel must observe two days of Yom Tob.
Summary: Visitors from the Diaspora who spend Yom Tob in Israel must observe two days of Yom Tob as they do back home. Although there were some Poskim who ruled differently, this is the position of Hacham Ovadia Yosef. He went so far as to say that if a visitor in this instance mistakenly recited the weekday prayer on the second day of Yom Tob, he must then pray the Yom Tob prayer.