We show that a ferromagnetic (F) slab with the in-plane magnetization sandwiched between two superconducting (S) films experiences strong demagnetization effect due to the Meissner screening of the stray magnetic field by superconductors. In the extreme case, the transition of the S film from normal to the superconducting state can switch the demagnetization factor from 0 to 1, which is in a sharp contrast with the S/F bilayers where such transition affects the magnetic field inside the F film only slightly. The giant demagnetization effect is shown to be qualitatively robust against the decreasing superconducting film thickness and may provide a hint toward the explanation of the anomalously large ferromagnetic resonance frequency shift recently observed for the S/F/S structures [Golovchanskiy et al., Phys. Rev. Appl. 14, 024086 (2020)].