We study the magnetic and superconducting proximity effects in a semiconducting nanowire (NW) attached to superconducting leads and a ferromagnetic insulator (FI). We show that a sizable equilibrium spin polarization arises in the NW due to the interplay between the superconducting correlations and the exchange field in the FI. The resulting magnetization has a nonlocal contribution that spreads in the NW over the superconducting coherence length and is opposite in sign to the local spin polarization induced by the magnetic proximity effect in the normal state. For a Josephson-junction setup, we show that the nonlocal magnetization can be controlled by the superconducting phase bias across the junction. Our findings are relevant for the implementation of Majorana bound states in state-of-the-art hybrid structures.