If you are not vaccinated and you have been exposed to measles, talk with your doctor about getting MMR vaccine. It is not harmful to get MMR vaccine after being exposed to measles, and doing so may possibly prevent later disease.
In other cases, you may be  given a medicine called immunoglobulin (IG) within six days of being exposed to measles, to provide some protection against the disease, or have milder illness. (1)