MRI utilizes strong magnetic fields and radio waves to generate images of the body's internal structures. When exposed to a magnetic field, protons in the body's water molecules align with the field. Radiofrequency pulses then disturb this alignment, and when the protons return to their original state, they emit signals that are captured to form images.