The invention relates to a rock core holder compatible with nuclear magnetic resonance, which can simulate pressures and temperatures of deep reservoirs, perform oil water displacement of a rock core under simulated formation conditions, and simultaneously perform nuclear magnetic resonance on-line measurement. According to the invention, a radio frequency coil is embedded in the rock core holder, and the signal to noise ratio is greatly increased when the rock core holder is compared with a conventional rock core holder. The rock core holder is made of nonmagnetic nonmetal materials, which avoids the damage of the magnetic field uniformity caused by magnetic materials, and also avoids the generation of eddy current in the holder by a pulse gradient. Compared with a conventional rock core holder, the invention not only greatly increases the signal to noise ratio, but also fully ensures the accuracy of nuclear magnetic resonance measurement results at a high temperature and a high pressure. The holder is applicable to on-line measurement of nuclear magnetic resonance relaxation spectra, diffusion-relaxation two-dimensional spectra, and imaging methods during rock core oil water displacement at a high temperature and a high pressure. In addition, the invention performs real-time tracking compensation of temperatures and pressures of ring-crush fluid, and thus ensures the reliability of rock core simulated formation conditions.