In the past, when the distance between communities was great, Ashkenazim lived in Ashkenaz (Germany), Sephardim in Sepharad (Iberia), and Yemenites in Yemen. Anyone who moved elsewhere would adopt the halakhic and liturgical customs of the new locale, since it is important that every individual community have a uniform custom and avoid the sort of factionalism that constitutes the prohibition of “lo titgodedu” (Devarim 14:1; the verse literally prohibits cutting oneself in mourning for the dead, but the Sages [Yevamot 13b] interpreted the prohibition to include becoming fragmented into different factions [“agudot agudot”]). As the Sages teach, this prohibition mandates that a single rabbinical court may not have some judges who follow the rulings of Beit Shammai and others who follow the rulings of Beit Hillel, so that the Torah is not made into two Torahs (ibid. 14a, according to Rif and Rosh).
Thus, immigrants would adopt fixed local customs. This is why we find people with the name “Ashkenazi” – denoting German origins – following Sephardic custom and families with the name “Frank” – indicating Sephardic origins – following Ashkenazic practice.
Even if, over time, immigrants become the majority of a given community, as long as they arrived as individuals, they assimilate into the existing community and must practice according to its customs (SA YD 214:2; OĤ 468:4; MB 14). In fact, it is possible that most Ashkenazim descend from Sephardic immigrants.
When an entire community migrates, it remains an independent community and does not become subsumed into the local community. Its members need not change their customs (BHL 468:4). Even if the pre-existing community constitutes the majority, as long as the newcomers associate as an independent community, they should continue practicing their initial customs. This applies to Eretz Yisrael, where, by the grace of God, the Ingatherer of scattered Jews, entire communities, led by Torah scholars, have migrated in recent centuries. Because they arrived as full-fledged communities, they were not assimilated into pre-existing communities, so they established synagogues to preserve their customs.
One who must pray regularly in a minyan conducted in a different nusaĥ – for example, one who moves to a place where the only minyan prays in a different nusaĥ – may decide how to act. One option is that she prays in the nusaĥ of that minyan whenever she prays with it. The second option is that she adheres to her ancestral nusaĥ while reciting those parts of the service that are said aloud in the custom of that congregation.
When one who habitually prays in one nusaĥ attends a minyan that prays in another nusaĥ on an occasional basis, the accepted ruling is that all passages recited aloud are prayed in the local nusaĥ, and all silent passages are recited in one’s ancestral nusaĥ (Peninei Halakha: Prayer 6:5).