The Shulchan Aruch · Orach Chayim
אורח חיים ל״חOrach Chayim 38
Siman 38 of 697 in Orach Chayim — 13 se'ifim
הלכות תפיליןLaws of Tefillin· siman 38
Se’if 1א׳
חוֹלֶה מֵעַיִם פָּטוּר מִתְּפִלִּין: הַגָּה: אֲפִלּוּ אֵין לוֹ צַעַר. אֲבָל שְׁאָר חוֹלֶה אִם מִצְטַעֵר בְּחָלְיוֹ, וְאֵין דַּעְתּוֹ מְיֻשָּׁב עָלָיו פָּטוּר וְאִם לָאו חַיָּב. (מָרְדְּכַי וְא"ח ומיי' פ"ד).
One who is ill in his intestines is dispensed from the [commandment to wear] tefillin. Rema: "Even if he is not in pain. However [regarding] all other sick people, if he is in pain due to his illness and his mind is not at ease, he is also dispensed [from the commandment]. Otherwise he is obligated."
Se’if 2ב׳
מִי שֶׁבָּרִי לוֹ שֶׁאֵינוֹ יָכוֹל לְהִתְפַּלֵּל בְּלֹא הֲפָחָה, מוּטָב שֶׁיַּעֲבֹר זְמַן הַתְּפִלָּה מִמַּה שֶּׁיִּתְפַּלֵּל בְּלֹא גּוּף נָקִי וְע"ל סי' פ'. וְאִם יֵרָאֶה לוֹ שֶׁיּוּכַל לְהַעֲמִיד עַצְמוֹ בְּגוּף נָקִי בִּשְׁעַת קְרִיאַת שְׁמַע, יָנִיחַ תְּפִלִּין בֵּין אַהֲבָה לִקְרִיאַת שְׁמַע, וִיבָרֵךְ.
One to whom it is clear that he cannot pray without flatulating, it is better that the time for Tefilah (the Shemoneh Esreh) should pass rather than that he should pray without a clean body. (And see further section 80.) And if it appears to him that he will be able to control himself to have a clean body [i.e. not flatulate] at the time of reading the Shema, he should put on tefillin between [the blessing just prior to Shema, ending in] Beahava and Shema, and bless [upon the tefillin].
Se’if 3ג׳
נָשִׁים וַעֲבָדִים פְּטוּרִים מִתְּפִלִּין, מִפְּנֵי שֶׁהוּא מִצְוַת עֲשֵׂה שֶׁהַזְּמַן גְּרָמָא: הַגָּה: וְאִם הַנָּשִׁים רוֹצִים לְהַחְמִיר עַל עַצְמָן מוֹחִין בְּיָדָם (כָּל בּוֹ).
Women and slaves are exempt from Tefillin because it is a positive commandment which is caused by time. Rema: And if the women want to be stringent for themselves, we protest against it (Kol Bo).
Shulchan Aruch, Orach Chayim — Torat Emet 363 edition, via Sefaria — public domain
English: Sefaria Community Translation — CC0