The core prohibition traces to the Gemara's teaching that one who attends to his own affairs before praying is considered to have built a forbidden altar, with Rav Idi bar Avin deriving from the pasuk "righteousness shall go before Him" (Berakhot 14a:15-16) that one must pray before setting out to his affairs; a parallel teaching forbids eating before praying, learned from "you shall not eat with the blood" (Berakhot 10b:29-30), and the Mishnah in Shabbat 9b:1-2 lists not sitting before the barber, not entering the bathhouse, and not beginning a meal or sitting in judgment before praying, though if one already began these activities he need not stop.
The Rambam codifies this broadly, forbidding tasting food, doing work, visiting a friend's house, or setting out on a journey from dawn until after Shacharit, but he carves out an exception: one who is engaged in Torah study when the time for prayer arrives must stop and pray, unless Torah study is his full-time occupation (Mishneh Torah, Prayer and the Priestly Blessing 6:4).
Among the Rishonim, Rashi (as cited by Beit Yosef, Orach Chayim 89:10) held that even learning itself is forbidden once the time for prayer arrives, but the Rosh qualified this to apply only to one who prays alone in his own study-house rather than going to shul, out of concern he will become absorbed and miss the time for Shema and prayer; Rabbeinu Yonah further limited the concern to one studying alone, since one who teaches others is certainly permitted, as the many's merit is weighty and the hour is passing. The Shulchan Arukh HaRav (Shulchan Arukh HaRav, Orach Chayim 89:7), the Mishnah Berurah (Mishnah Berurah 89:30-32), the Arukh HaShulchan (Arukh HaShulchan, Orach Chaim 89:27), and the Kaf HaChaim (Kaf HaChayim on Shulchan Arukh, Orach Chayim 89:44-46) all preserve this structure: one habituated to praying in shul may learn at home until the time for communal prayer, and one teaching others may continue even if not going to shul, since public merit is great and the lesson would otherwise be lost.
Modern codifiers maintain the same line: Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 89:47 restates that even learning is forbidden once the time for prayer arrives for one who prays alone and is not accustomed to shul, but permits one accustomed to shul, and permits a teacher of others regardless; Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 89:48 clarifies that the prohibition is only against beginning to learn after the time has arrived — if one was already learning beforehand, he need not stop.
Related sources extend or bound this concern: the Jerusalem Talmud teaches that one should not stand to pray out of idle conversation, laughter, or frivolity, but rather out of a matter of Torah, and likewise should not part from a companion except with words of Torah (Jerusalem Talmud Berakhot 5:1), while Berakhot 26a:11-12 establishes the time-boundaries of Shacharit, Minchah, and Maariv against which the prohibition operates, and Berakhot 11b:10-12 addresses the blessing required for one who rises early to study before reciting Shema.
Nitei Gavriel, Yom Tov vol 2, perek 38 applies this concern practically, questioning delay for Yom Tov meal preparation on the grounds that even Torah study is forbidden before Shema and prayer, and Ketzos HaShulchan 12 likewise holds that even learning is prohibited before prayer, directing one to pray immediately at sunrise, with an allowance for someone who cannot wait to eat to pray at home first, but not for one who has already come to the synagogue.
Rav Mordechai Eliyahu applies the halacha to concrete timing: he rules that one may attend to needs of a mitzvah, such as purchasing items for Shabbat or Yom Tov, before praying, though it is proper to be stringent even there, while learning remains forbidden once the time for prayer has arrived, so one should calculate whether he has enough time to reach the Amidah by sunrise, and if time remains he may learn (Maamar Mordechai Limot HaChol 9:19). In the context of Chanukah candle-lighting times, he adds that one need not be stringent about learning when relying on poskim who hold the time for lighting is at the end of sunset, though within the half-hour before nightfall one should be stringent even about learning (Maamar Mordechai Hilchot Chanukah 8:21), and he cites the Machatzis HaShekel's position that even learning is forbidden once the time arrives, raising the question of why a stringency of a half-hour before the time should not likewise apply (Maamar Mordechai Hilchot Chanukah 8:20).
Tzitz Eliezer (14:33) treats this question as a practical responsum, holding that it is improper to impose a permanent prohibition on the matter, citing the Tehillah LeDavid and a discussion of the Rashba's view, while still maintaining that one should not study even during the day.
B'tzel HaChochma (4:150) addresses a related question, concluding that one may perform a mitzvah before reciting Birkat HaTorah, though the pious and the stringent recite the brachah first, distinguishing this from reciting pesukim, which should not be done beforehand.
Several sources bear on adjacent angles of the same topic: Berakhot 30b:5 discusses the requirement of proper intent in prayer; Igros Kodesh letter 503 discusses whether teachers and students may pronounce divine names while learning outside the obligatory time, concluding this is permitted for teaching young children but not for an adult student; Sefer HaIttur 53b discusses when one who is a baal keri may engage in Torah matters or recite blessings; and Peninei Halakhah, Prayer 10:7 discusses whether one who stayed awake all night must recite Birkot HaTorah again before Shacharit.