Inspired by this question ( SE Challenge: Halachot in which rulings range from permissible to Torah violation?) , I thought I'd go further. Can you think of any Halachoth whose rulings range from obligatory to a (Torah) prohibition?
Easy. Just take any halacha whose rulings range from permissible to forbidden and have a parent ask you to do it.
For example: If a parent asked you to carry something on Shabbos within an eruv in a large city. One opinion would be that you must do it because of kibbud av v'em. The other opinion would say it's assur, and that you are required to disobey your parent.
Following on Shalom's answer, any case where one principle is overriding another. If two people disagree as to whether an ailment requires driving to the hospital on Shabbat (or otherwise violating Shabbat or Yom Tov), that would put one side as: you must and the other as assur min hatorah. A borderline case of murder/idolatry/sexual immorality could have a machloket between "you must 'sin' to save your life" or "you must die rather than sin".
One will certainly find posters in Israel claiming that it is both prohibited (Biblically?) to vote, and obligatory (Biblically?) to do so.
While you'll occasionally meet a Jew who refrains from consuming grain grown after last Passover (chadash/ yashan), Rabbi Michel Shurkin is said to prohibit it in Israel as the risk of insect infestation is too high.
Similarly, applying oral suction after circumcision is something some communities consider obligatory, others ban for health reasons.
But all of these involve more considerations than a single point of dispute in halacha.
Many prohibit shaving on Chol HaMoed; Rabbi Joseph Soloveichik told those students who asked him, if they would follow his opinion, that they were obligated to do so out of honor for the holiday.
Of course the easiest way to find a bona-fide matter where the opinions range from prohibited to obligatory is where the obligation is overriding an otherwise-prohibited situation. The opening Mishna in Yevamot construes a case whereby the House of Shammai says this woman is obligated to either marry this man or perform a chalitza ceremony, with marriage being the Biblically-preferred choice. The House of Hillel maintains in such a case that marriage would be prohibited.
Here are two cases from the halachos of bread. Both stem from the halacha that if you eat bread and are full, you have a Biblical mitzvah to say a concluding blessing according to all opinions, and are assuming that an incorrect blessing is a Biblical prohibition of taking Hashem's name in vain.
If you make normal dough, and then instead of baking it fry it in oil, it is a dispute between Rabbeinu Tam and the Rash if eating a meal of it gives it the status of bread. Rabbeinu Tam holds that it is bread, and the Rash holds it cannot become bread. If you eat your full of it, Rabbeinu Tam would tell you that you have a Biblical obligation to recite Birkas HaMazon, and the Rash would tell you that you have transgressed taking Hashem's name in vain multiple times.
There is a three-way dispute what qualifies as Pas Haba B'kisanin. 1 - Something in which the dough was filled with sweets or fruit. 2- Something dry and hard. 3 - Something in which the dough was made with non-water liquids. According to most opinions (the only exceptions of which I am aware are the Nesivos in his introduction to the Hagaddah and the Ma'amar Mordechai) these explanations are mutually exclusive. Therefore, what qualifies according to one opinion as Pas Haba B'kisanin is not Pas Haba B'kisanin according to the other two, and is rather ordinary bread. The halacha of Pas Haba B'kisanin is that if you eat the amount that a person would normally eat as a meal, you make Hamotzi and Birkas HaMazon, but otherwise you make a Mezonos and Al Hamichya. That being said if you eat any food which satisfies at least 1 but not all 3 types of Pas Haba B'kisanin, and you eat enough that you personally are full but not the amount which makes a normal meal, according to the opinions that you ate normal bread you have a Biblical obligation to say Birkas HaMazon, and according to the opinions that you ate Pas Haba B'kisanin you have a Biblical prohibition to say Birkas HaMazon.
(Extensive sourcing to follow when I have my notes available)
An answer me'inyana d'yoma:
The Mishnah/Talmud discuss how long it takes for dough to become chametz.
מתני' בצק החרש אם יש כיוצא בו שהחמיץ הרי זה אסור גמ' אם אין שם כיוצא בו מהו א"ר אבהו אמר ר' שמעון בן לקיש כדי שילך אדם ממגדל נוניא לטבריא מיל ונימא מיל הא קמ"ל דשיעורא דמיל כממגדל נוניא ועד טבריא
MISHNAH. [REGARDING] ‘DEAF’ DOUGH, IF THERE IS [A DOUGH] SIMILAR TO IT WHICH HAS BECOME LEAVEN, IT IS FORBIDDEN. GEMARA. What if there is no [dough] similar to it? — Said R. Abbahu in the name of R. Simeon b. Lakish: [The period for fermentation is] as long as it takes a man to walk from the Fish Tower [Migdal Nunia] to Tiberias, which is a mil. Then let him say a mil? — He informs us this, [viz.,] that the standard of a mil is as that from Migdal Nunia to Tiberias. (Soncino translation)
However, in the Yershalmi (3:2) the figure given is 4 mil:
רבי אבהו בשם רבי יוחנן בצק שצינן לא היה שם אחר כיוצא בו שהחמיץ עד איכן רבי יעקב בר אחא ר' עולא דקיסרין בשם רבי חנינה עד כדי הילוך ארבעת מיל
Thus, if there was dough which was left to rise for longer than the time it takes to go 1 mil but less than the time it takes to go 4 mil, according to the Bavli it would be chametz but according to the Yerushalmi it would be matzah. If this would be the only available bread-product on the first night of Passover, according to the Yerushalmi one would have a Biblical obligation to eat it, while according to the Bavli he would be Biblically forbidden to eat it with a punishment of kares.
[I am aware that there have been several proposals attempting to reconcile the Bavli and yerushalmi; this answer would only be true according to the simple rading.]
Reciting the blessing of kiddushin
Rambam rules that the blessing must be recited before the actual kiddushin, in accordance with the principle that blessings on mitzvot must be recited prior to performing the mitzva, and if the blessing is recited after the actual kiddushin it is a blessing in vain. (Hilchot Ishut 3:23)
In his gloss thereto Ra'avad states the exact opposite. He rules that the blessing must be recited after the actual kiddushin because the groom cannot be certain that the bride will accept the kiddushin, and if she doesn't accept it and the blessing was already recited it would be a blessing in vain.
Thus, reciting the blessing after the kiddushin is obligatory according to Ra'avad but forbidden according to Rambam. Reciting the blessing before the kiddushin is obligatory according to Rambam but potentially forbidden according to Ra'avad.
This is similar to my other answer, and indeed this can conceivably occur any time there is a dispute whether a blessing is necessary. However, these examples in particular contain explicit statements from the opposing poskim showing the range of obligatory to prohibited.
Eating meat from almost any shechita, for example Lubavitch (Lubavitchers must eat it; some non-Lubavitchers would hold it's assur according to the strictest prohibitions) and Beit Yosef (Sefardim essentially must eat it; many Ashkenazim consider it either forbidden or treyf).
Will add better sourcing and possibly more details soon iy"H
Living in Israel. (Sources to come iy"H)