For a majority of MRI exams, the patient does not need any medication before or during the exam. Some exams require a contrast agent, which is typically injected and is extremely useful for visualizing blood flow. Sometimes a patient will be prescribed an MRI both without, and then with, contrast, in order to compare the images.
Some patients who are claustrophobic may be prescribed a sedative, or even be anesthetized to receive an MRI exam.
The MRI process, itself, does not require any medication in order to work. It is only that some particular pathologies or anatomies are better visualized in a shorter period of time through the use of contrast agents.