In the Star Trek Universe the transporter can be used to move people and objects across great distances. Although from the name transporter one might assume it moves things through space, it actually doesn’t. A transporter disassembles the person or object at the source, and then reassembles an exact copy at the destination to recreate the person. While philosophers have endlessly debated whether a transporter does in fact kill a person and then create a new one, in the Star Trek universe the technology is clearly treated as something that moves rather than kills. A transported person has the same memories, desires, personality, and consciousness as they did beforehand.
The religious person is confronted with a dilemma – while the transporter may be able to perfectly recreate matter, what about the soul? Judaism (and some other religions) believe that what makes each person an individual is their soul. Hashem creates a soul for each person, and that soul is what gives a person understanding and wisdom. (Niddah 31a). Even if a transporter creates a new body, the person would not be the same as a transporter cannot possibly create a new soul. The resulting soulless body would not be the same person, might not be alive, and without a soul might not even be obligated to perform mitzvot.
While Star Trek is famously atheistic and does not directly address the issue of the soul (or even consciousness) with regard to the transporter, there are mentions of a soul in the show. At the end of the court case in Measure of a Man judge Phillipa Louvois says that the main issue at stake is whether Data has a soul. Her implication is clearly that she believes, as we do, that biological humanoids have a soul. So what happens during transport?
Since the soul has no physical existence, there is also no reason to believe it is bound by the physical laws of the universe. The soul is the creation of hashem (Bereshit 2:7, Megillah 14a) and can be taken away by hashem (Shabbat 32a). Hashem can even give a person an extra soul (Beitzah 16a), or return a soul to someone whose soul has departed (Shabbat 88b). According to several sources, when a person sleeps their soul departs to Hashem and Hashem returns it in the morning. (Eichah 3:23, Midrash Tanhuma 16, kitzur Shulchan Aruch 1:2)
For the transporter to work as it does in the Star Trek universe, Hashem must provide the new body with the soul. In the case of Riker being duplicated in the episode Second Chances, Hashem must have duplicated the soul, or provided Thomas with a new one. (Perhaps that’s why Thomas was able to do something that was unthinkable to Will and join the Marquis – he had a different soul than Will).
The Talmud provides a blessing of thanks to be said every morning to Hashem for returning our soul to us. It isn’t said very frequently anymore, with most siddurim instead opting to include the Modeh Ani prayer. (Mishnah Berurah 1:8, Aruch Hashulchan OC 4:20 1), which goes as follows:
מודֶה [מודָה] אֲנִי לְפָנֶיךָ מֶלֶךְ חַי וְקַיָּם, שֶׁהֶחֱזַרְתָּ בִּי נִשְׁמָתִי בְּחֶמְלָה, רַבָּה אֱמוּנָתֶךָ:
I offer thanks to You, living and eternal King, for You have mercifully restored my soul within me; Your faithfulness is great. [source]
Modeh Ani was written by Rabbi Moshe ibn Yehudah Makhir who lived in Tsfat in the 16th century and founded the Ein al-Zeitun yeshiva. He is best known for his work Seder Hayom which includes prayers, including the Modeh Ani, which draws from various passages in the Talmud and Eichah.
As Modeh Ani is said to than Hashem for returning a person’s soul, it seems natural then to say that same prayer after completing a transport as Hashem has been kind enough to once again return a soul to its body. I’m sure that halachic publications in the 24th century will mention it as a standard prayer that a Jew should say after transport.