MRI works by aligning the hydrogen atoms in the body using a powerful magnetic field. When exposed to radio waves, these atoms emit signals that are detected and converted into images by a computer. This technique provides high-resolution images that can reveal abnormalities in tissues and organs.