I couldn't find any good sources for an answer.

Some random person on Reddit said: "MRI scans can sometimes cause neuro stimulation and it can feel like slight shocks because of a nerve being stimulated."

Somebody on Quora said: "Most likely you experienced peripheral nerve stimulation from the magnetic fields. It’s fairly common and completely harmless."