The Tur and the Shulchan Aruch wrote in section 1 that the chalitzah of one who is subject to a negative commandment, or a positive commandment, or a secondary prohibition, does not exempt her co-wife, but the chalitzah of her co-wife exempts her. Their words are based on the words of the Rambam in chapter 7 regarding the law that an invalid chalitzah does not exempt the co-wife. He wrote in law 10: It appears to me that such is the law regarding two yevamot coming from one house, where one of them is forbidden to her yavam due to a secondary prohibition, or from those subject to negative commandments, or from those subject to positive commandments, that if he performed chalitzah for the forbidden one, her co-wife is not permitted; if he performed chalitzah for the co-wife, the forbidden one is permitted. Thus far his words. And they wondered about him, for in the Gemara (20b) it is explicitly stated to the contrary, as the Shas cited a Baraita: One of a commandment prohibition or a holiness prohibition—if he had intercourse with her or performed chalitzah for her, her co-wife is exempted; see there. And so it is explicitly stated in a similar case (ibid.). There is one who wishes to say that it deals with a case where her co-wife is also forbidden like her, for in such a case even an invalid chalitzah exempts her co-wife, as he wrote in siman 170 regarding something similar (Beit Shmuel siman 170, subsection 13). However, besides the fact that it does not imply this, and the Rambam should have clarified this, furthermore from the Tosefta (chapter 6) the opposite is clarified, as it is taught there: If one of them was forbidden etc. an ervah prohibition, and he performed chalitzah for her, he has done nothing; if she was a commandment prohibition or a holiness prohibition, and he performed chalitzah for her or had intercourse with her, her co-wife is exempted. Thus far his words. Behold, it is explicit that only she is forbidden and not her co-wife. And there is one who answered that the Baraita in the Gemara holds there is no zika (the Gra there, subsection 45), and whoever holds thus, even a poor chalitzah exempts a co-wife (Tosafot 26b). But we rule that there is zika. And this too is difficult, for if so, the Shas should have raised a difficulty from it against the one who holds there is zika; however, even without this Baraita there is a dispute of Tannaim regarding this (Rabban Gamliel and the Rabbis 51a). Furthermore, it is difficult because in the Yerushalmi (chapter 2, halacha 3) it is also stated so, that for a commandment prohibition and a holiness prohibition, if he performed chalitzah for her, her co-wife is exempted, see there; and the Yerushalmi holds (in chapter 3) that there is zika, see there.
כתבו הטור והש"ע סעיף א' דחליצת בעלת הלאו או העשה או השנייה אינה פוטרת צרתה וחליצת צרתה פוטרת אותה ודבריהם מיוסדים על דברי הרמב"ם בפ"ז בדין שחליצה פסולה אינה פוטרת את הצרה וכתב בדין י' יראה לי שכך הדין בשתי יבמות הבאות מבית אחד והאחת מהן אסורה על יבמה משום שנייה או מחייבי לאוין או מחייבי עשה שאם חלץ לאסורה לא הותרה צרתה חלץ לצרה הותרה האסורה עכ"ל ותמהו עליו דבגמ' (כ':) מפורש להיפך דהש"ס הביא ברייתא איסור מצוה ואיסור קדושה בא עליה או חלץ לה נפטרה צרתה ע"ש וכן מפורש בכה"ג (שם) ויש מי שרוצה לומר דמיירי כשגם צרתה אסורה כמותה דבכה"ג גם חליצה פסולה פוטרת צרתה כמ"ש בסי' ק"ע בכעין זה (ב"ש סי' ק"ע סקי"ג) ולבד שלא משמע כן והיה לו להרמב"ם לבאר זה עוד מתוספתא (פ"ו) מתבאר להיפך דתניא שם היתה אחת מהן אסורה וכו' איסור ערוה וחלץ לה לא עשה כלום היתה איסור מצוה ואיסור קדושה חלץ לה או בא עליה נפטרה צרתה עכ"ל הרי מפורש דרק היא אסורה ולא צרתה ויש מי שתירץ דהברייתא שבגמ' ס"ל אין זיקה (הגר"א שם סקמ"ה) ומאן דס"ל כן אפילו חליצה גרועה פוטרת צרתה (תוס' כ"ו:) ואנן קיי"ל דיש זיקה וגם זה דוחק דא"כ הו"ל להש"ס להקשות ממנה למאן דס"ל יש זיקה אך דבלא ברייתא זו יש פלוגתא דתנאי בזה (ר"ג ורבנן נ"א.) ועוד קשה דבירושלמי (פ"ב ה"ג) איתא נמי כן דאיסור מצוה ואיסור קדושה חלץ לה נפטרה צרתה ע"ש והירושלמי ס"ל (בפ"ג) דיש זיקה ע"ש: