OPINIONS: The Gemara teaches that one may not receive a wage for teaching Torah. Nevertheless, there are several types of circumstances in which one is permitted to receive a wage.
(a) Rebbi Yochanan rules that one is permitted to receive a wage for teaching the "Pisuk Ta'amim" (the cantillation marks on the words in the Chumash), since those notes are not mid'Oraisa. Rebbi Yochanan's ruling implies that one is permitted to receive a wage for teaching Halachos or Mitzvos that are mid'Rabanan. The HAGAHOS MAIMONIYOS (Hilchos Talmud Torah 1, cited by the REMA YD 246:5) writes that one therefore is permitted to receive a wage for teaching rabbinical enactments.
(b) The Gemara states that one who teaches small children who need to be watched may receive a wage for teaching them, since the salary is paid not for the teaching but for the supervision. The Gemara assumes that adults, and even young girls (who tend to be more mature and independent than young boys), do not need to be watched, and thus one may not receive a wage for teaching them. (See the ROSH who writes that little children need to be kept off the streets so that they will not cause damage and become accustomed to doing bad things.) Obviously, in a place where young girls and older children need to be supervised, their teacher may receive a wage.
(c) The RAN and other Rishonim quote the Yerushalmi which says that one who chooses to teach Torah at the expense of working in a profession may receive a wage to compensate for the loss of income that he incurs as a result of teaching. In such a case, he does not take money for the teaching but for not working.
(d) TOSFOS in Bechoros (29a) and the ROSH write that one who has no other source of income may receive a wage for teaching.
HALACHAH: The SHULCHAN ARUCH (YD 246:5) rules that nowadays teachers may receive salaries for teaching Torah for the abovementioned reasons.
The Gemara discusses two types of payment for work (which does not involve Chilul Shabbos) performed on Shabbos. The first type is "Havla'ah," and the second type is payment for a Mitzvah done on Shabbos.
1. HAVLA'AH. The Gemara teaches that one who teaches Torah on Shabbos may not receive a wage specifically for his work on Shabbos. If, however, he is paid for a week or month at a time, he may be paid for his teaching for all seven days of the week since it is not evident that he is being paid for his work done on Shabbos.
This example of Havla'ah applies only when he is paid for an entire week or more and implies that only when most of the weekly salary is for work done on weekdays is it considered a permissible form of Havla'ah. The Poskim write, however, that this is not necessary. The MISHNAH BERURAH (OC 306:21) quotes the CHAYEI ADAM who permits Havla'ah for work done on Shabbos together with a few hours of work done on Erev Shabbos and on Motza'i Shabbos.
2. WAGES FOR WORK DONE FOR A MITZVAH ON SHABBOS. The Gemara says that one is prohibited to receive a wage for teaching Torah only on Shabbos, even though teaching Torah is a Mitzvah. The Gemara also quotes a Beraisa which says that the people who guard the Parah Adumah from Tum'ah may not take a wage for their services on Shabbos (without Havla'ah). The Beraisa implies that even though one's permissible work on Shabbos involves a Mitzvah, he may not take a wage for his work.
TOSFOS (37b) points out that although one may not involve himself in business matters on Shabbos, he may involve himself in matters that pertain to Mitzvos even when those matters involve expenses and costs for the Mitzvos. Why, then, is one prohibited from taking a wage for doing a Mitzvah on Shabbos, such as for guarding the Parah Adumah?
Tosfos answers that although guarding the Parah Adumah is a Mitzvah, receiving a salary for doing so is not part of the Mitzvah, and therefore it is prohibited.
The TUR (OC 585) quotes the Gemara here and writes that he does not know the source for permitting one who blows the Shofar on Rosh Hashanah to receive a salary. The BEIS YOSEF there quotes the MORDECHAI in Kesuvos who writes that receiving a salary for blowing the Shofar is permitted since the salary is paid for the Mitzvah. The Beis Yosef explains that this is not considered doing business on Shabbos because the contract was made before Shabbos. Although the Chachamim do not want people to take such wages because it looks as though one is working on Shabbos, they did not prohibit it and therefore for the sake of a Mitzvah it certainly is permitted. (The Beis Yosef cites the Gemara in Pesachim (50b) which says that a Meturgeman who receives a wage will see no blessing from his wage, since he looks like he receives the wage for work done on Shabbos. The Gemara there implies that although receiving a wage for work done on Shabbos is not prohibited, it is not commendable and is strongly discouraged.)
The Tur's question, however, remains. The Gemara implies that one is prohibited to receive payment for work done on Shabbos even for a Mitzvah. The TAZ answers that one is permitted to receive payment only for a Mitzvah which is necessary for Shabbos or Yom Tov (for example, the Shali'ach Tzibur or Ba'al Toke'a may receive payment for their services) but not for other Mitzvos (such as guarding the Parah Adumah).
The MISHNAH BERURAH (OC 306:24) writes that the common practice is to be lenient with regard to receiving a wage for a Mitzvah done on Shabbos. One who wants to conduct himself stringently (and still receive payment for his efforts on behalf of the Mitzvah on Shabbos) should not set any fee prior to Shabbos, but rather he should accept his "wage" as a gift after Shabbos. Alternatively, he may perform some work during the week and be paid for his work done on Shabbos through Havla'ah.
The MISHNAH BERURAH (ibid.) adds that a midwife (or any other medical practitioner) certainly is permitted to receive payment for her work on Shabbos. The Poskim write that such a person should not be stringent not to take a wage, because this might cause him or her to avoid giving vital medical assistance when needed.