Rare earth fluoride molten-salt electrolytic slag (REFES) is a precious rare earth element (REE) secondary resource, and considerable amounts of REEs exist in REFES as REF3; they are difficult to dissolve in acid or water and impede efficient REE extraction. In REFES recovery, the REF3 species in REFES are usually transformed into acid-soluble rare earth compounds by NaOH roasting or sulfating roasting and then extracted by acid leaching. Moreover, the fluorides in REFES are released as HF gas in the roasting process or enter the liquid phase during the water washing process; both of these processes cause fluorine pollution. Fixing the fluorine into the solid slag provides a way to avoid fluorine pollution. In this study, a novel method was proposed to extract REEs from REFES via MgCl2 roasting followed by HCl leaching. Thermodynamics calculations and thermogravimetry‒differential thermal analyses (TG-DTA) were conducted to investigate the reactions occurring in the roasting process. First, MgCl2 reacts with the REF3 and RE2O3 to form RECl3 and REOCl, respectively. Second, the RECl3 absorbs water and forms RE(OH)3. Third, MgCl2·6H2O is gradually dehydrated to MgCl2·2H2O and reacts with REF3 and RE(OH)3, and REOCl, MgF2 and MgO are formed. Through HCl leaching, the REOCl in the roasting products is leached by HCl acid, while fluoride remains in the solid slag as MgF2. The optimum experimental conditions are as follows: mass ratio of MgCl2 to REFES of 30%, roasting temperature of 700 °C, roasting time of 2 h, hydrochloride acid concentration of 4 mol/L, leaching time of 2 h, leaching temperature of 90 °C and leaching L/S ratio of 20:1. The efficiencies for total leaching of the REEs, La, Ce, Pr, and Nd are 99.13%, 99.20%, 98.42%, 99.38%, and 99.08%, respectively. Moreover, the concentration of fluoride in the leaching solution is 2.191 × 10−6 mol/L. This method has a short process flow with low reagent costs, and the problem of fluoride pollution from REFES recovery is solved; thus, our study has great industrial application potential.