We present neutron-scattering studies of the interplanar magnetic correlations in the high-temperature superconductor La1.88Sr0.12CuO4 (Tc=27 K). The correlations are studied both in a magnetic field applied perpendicular to the CuO2 planes, and in zero field under different cooling conditions. We find that the effect of the magnetic field is to increase the magnetic scattering signal at all values of the out-of-plane wave vector L, indicating an overall increase of the magnetic moments. In addition, weak correlations between the copper oxide planes develop in the presence of a magnetic field. This effect is not taken into account in previous reports on the field effect of magnetic scattering, since usually only L≈0 is probed. Interestingly, the results of quench-cooling the sample are similar to those obtained by applying a magnetic field. Finally, a small variation of the incommensurate peak position as a function of L provides evidence that the incommensurate signal is twinned with the magnetic scattering from the dominant and subdominant structural twin displaying peaks at even and odd values of L, respectively, in our crystal.