TEVILAH BI'ZMANAH MITZVAH [Tevilah:time]
Gemara
Nidah 29b - Beis Shamai: If a woman does not know when or what she miscarried, and saw blood for three straight weeks, and the next week did not see ...she is Tovel 95 times;
Beis Hillel say, she is Tovel 35 times;
R. Yosi b'Rebbi Yehudah says, it suffices for her to be Tovel once at the end.
The first Tana (who taught the opinions of Beis Shamai and Beis Hillel) holds that Tevilah bi'Zmanah Mitzvah (it is a Mitzvah to be Tovel to become Tahor at the first opportunity. We are unsure when this is, therefore she is Tovel at every possible such time, even though (with one exception) only the last Tevilah permits her);
R. Yosi b'Rebbi Yehudah disagrees.
Yoma 88a - Beraisa #1: Anyone obligated to immerse may do so normally on Yom Kipur:
A Nidah or Yoledes may immerse on Yom Kipur night;
A Ba'al Keri may immerse at any time until (the time of) Minchah.
R. Yosi permits at any time on Yom Kipur.
Contradiction (Beraisa #2): The following may immerse normally on Yom Kipur: a Zav, Zavah, Metzora, Metzora'as, Bo'el Nidah, and Tamei Mes;
A Nidah or Yoledes may immerse on Yom Kipur night;
A Ba'al Keri may immerse at any time on Yom Kipur;
R. Yosi says, he may (some texts - need) not immerse after Minchah.
Answer: If the Ba'al Keri already prayed Ne'ilah, R. Yosi permits until Minchah; if not, he permits the entire day.
Suggestion: Chachamim hold that Tevilah bi'Zmanah Mitzvah, and R. Yosi holds that Tevilah bi'Zmanah Lav Mitzvah.
Objection - Beraisa #3: If Hash-m's name was written on a person...and he has a Mitzvah to immerse, he wraps a reed around the name;
R. Yosi says, he immerses normally.
The first Tana holds that Tevilah bi'Zmanah Lav Mitzvah, and R. Yosi holds that it is a Mitzvah!
Correction: Rather, Beraisa #2 should say that R. Yosi b'Rebbi Yehudah permits only until Minchah. He says (Nidah 29b) that it suffices for the confused Yoledes to be Tovel once at the end.
Yoma 8a (Beraisa - R. Meir): For seven days beforehand, we sprinkle on both (a Kohen who will burn Parah Adumah and a Kohen Gadol who will serve on Yom Kipur) with Mei Chatas from every Parah Adumah burned previously;
R. Yosi says, we sprinkle only on days three and seven.
Suggestion: R. Meir holds that Tevilah bi'Zmanah Mitzvah, and R. Yosi holds that Tevilah bi'Zmanah Lav Mitzvah.
Rejection: All hold that Tevilah bi'Zmanah Mitzvah. They argue about whether or not we equate sprinkling (Mei Chatas to Metaher from Tum'as Mes) to Tevilah.
Rishonim
Note: Nowadays, since we are all Tamei Mes, Tevilah bi'Zmanah is relevant only to a woman immersing from Nidah to become permitted to her husband.
R. Tam (Tosfos DH d'Kulei): The Halachah follows R. Yosi b'Rebbi Yehudah.
Source #1: Nowadays, no woman is Tovel bi'Zmanah (mid'Rabanan, Benos Yisrael are stringent to wait seven full clean days before immersing after any sighting of blood).
Source #2 (Nidah 67b) Question: Nowadays, we consider any woman who saw blood to be a Safek Zavah. If so, she should be Tovel during the seventh clean day!
Inference: (Also) in the days of the Gemara women were not Tovel bi'Zmanan!
Rebuttal (of both sources - Bach YD 197 DH v'R. Chananel): Nowadays, Tevilah after seven clean days is considered bi'Zmanah (it is the first opportunity)!
R. Chananel (brought in Tosfos ibid.): The Halachah follows Beis Shamai and Beis Hillel.
Rebuttal (Tosfos): Granted, the Halachah follows Beis Hillel. But surely R. Yosi b'Rebbi Yehudah does not oppose Beis Hillel! Rather, he argues with the first Tana and says that Beis Hillel (and Beis Shamai, since he did not say that they argue) hold that Tevilah bi'Zmanah Lav Mitzvah.
Source #1 (Beis Yosef YD 197 DH u'Mah she'Chosav Hilkach): The Yerushalmi says that a man may assume that his wife was Tovel at her first opportunity, and infers that a woman must become Tehorah as soon as she can (even nowadays).
Rebuttal (Bach ibid. DH u'Mah she'Chosav): She must become Tehorah as soon as she can lest her husband assume that she was Tovel at her first opportunity (but not because Tevilah bi'Zmanah Mitzvah)!
Source #2 (Mordechai, brought in Beis Yosef ibid.): R. Tam holds that since women are not Tovel bi'Zmanan mid'Oraisa, they may not be Tovel on Shabbos or Yom Kipur. However, many Poskim permit, and it is our custom that they may be Tovel on Shabbos.
Rebuttal (Beis Yosef ibid.): Nowadays women do not be Tovel even during Aveilus, all the more so not on Yom Kipur or Tish'ah b'Av! Also, the Gemara forbids a woman to be Tovel unless her husband is in the city (otherwise, it is for Zenus)! Nevertheless, if a woman's husband is in the city she should be Tovel at her first opportunity. Yehoshua was punished for (delaying to return the Aron to its place, thereby) inhibiting Yisrael from Peru u'Rvu for one night (Eruvin 63b).
Bach (ibid.): R. Tam agrees that a woman may be Tovel on Shabbos if her husband is in the city
Tosfos (ibid.): Our Gemara established both Tana'im to hold that Tevilah bi'Zmanah Mitzvah. This does not show that this is the Halachah, for it could not have said that both hold Lav Mitzvah.
Ra'avad (Ba'alei ha'Nefesh, Sha'ar ha'Tevilah 3:6): The She'altos (96) permits Tevilah on Shabbos, relying on Chafifah from before Shabbos or Yom Tov because Tevilah bi'Zmanah Mitzvah. Since nowadays we do not have Tevilah bi'Zmanah Mitzvah, Tevilah on Shabbos is forbidden.
Rebuttal (Beis Yosef YD 199 DH v'Chosav ha'Ra'avad): The She'altos wrote Halachah l'Ma'aseh, and from the days of the Gemara there was not Tevilah bi'Zmanah Mitzvah (Nidah 67b)! Rather, Tevilah at the first opportunity is considered bi'Zmanah.
Maharil (Teshuvos Chodoshim 96): Tevilah is forbidden on Shabbos because we do not bathe on Shabbos, and lest one squeeze hair. Also, where women are Tovel in rivers perhaps they will carry a towel or water four Amos in a Karmelis. The Or Zaru'a permits Tevilah on Shabbos and Yom Kipur because Tevilah bi'Zmanah Mitzvah, but we hold Ein Mitzvah, so it is forbidden unless it will cause Bitul of Peru u'Rvu or Mitzvas Onah.
Rebuttal (Teshuvas Chasam Sofer YD 196): Even for the light Mitzvah of going to visit one's Rebbi one may walk through water on Shabbos; we do not decree lest he squeeze. The Beis Yosef preferred to bring a proof for Tevilah itself. Tosfos proves this from the Heter for a Nidah to scheme and be Tovel in her clothes in order to be Tovel them. Even though she could be Tovel without her clothes, we do not decree lest she squeeze! The Beis Yosef did not bring this proof. Since she may immerse them only by wearing them, she will remember not to squeeze them.
Note: At the end of the above Teshuvah, the Maharil himself said that people think that it is forbidden due to bathing and squeezing. Really, we forbid because we do not allow distancing Chafifah from Tevilah needlessly.
Poskim
Shulchan Aruch (YD 197:2): If a woman's husband is in the city, it is a Mitzvah for her to be Tovel at the first opportunity to avoid Bitul of Peru u'Rvu even for one night.
Rema: She may be Tovel on Shabbos only if it is her husband is in the city and it is her first opportunity.
Since (Agur and Maharil, brought in Beis Yosef DH Kasuv): A woman may be Tovel on Shabbos (or Motza'ei Shabbos) only if it is her first opportunity.
Rebuttal (Beis Yosef ibid.): Nowadays, women are never Tovel at the first opportunity mid'Oraisa, nevertheless they are Tovel on Shabbos and Motza'ei Shabbos!
Taz (2,3): Even according to the opinion that Tevilah bi'Zmanah Lav Mitzvah, when her husband is in town it is a Mitzvah because of Peru u'Rvu. The Rema rules that this Mitzvah permits Tevilah on Shabbos.
Teshuvas Chasam Sofer (YD 196): There are three levels of Tevilah bi'Zmanah Mitzvah. The greatest is a woman who is Tovel at the first opportunity mid'Oraisa, to become permitted to her husband. Nowadays we consider women to be Safek Zavos for any sighting, so this is rare. Tevilah at (what is now) the first opportunity also fulfills Tevilah bi'Zmanah Mitzvah. The lowest level is Tevilah of people and Kelim for the sake of Taharos, especially at the time of the Regel.
Chachmas Adam (118:8): We hold that Tevilah bi'Zmanah Lav Mitzvah. Therefore, single women are not Tovel. If a woman's husband is around she may be Tovel on Shabbos if she was unable to beforehand, or if she realized only now that her last Tevilah was invalid. There are different customs about a Yoledes who delayed immersing due to weakness or her husband was away, and he came on Erev Shabbos; if there is no known custom one may be lenient. In any case she may immerse just before dark and return home after dark; Chachamim did not decree about Shevus (it looks like she fixes herself) Bein ha'Shemashos. Even where people are stringent on Shabbos, one may be lenient on Yom Tov.