Milligrams (mg) are a measure of mass(weight). A milligram is one thousandth of a gram.
International Units (IU) are a measure based on the biological activity of a substance in the body. These units are arbitrarily set by a committee of researchers commissioned by the World Health Organization. The goal is to provide a measure of the effect on the body a substance will have regardless of its mass.
For Ex: 1 IU of Vitamin C is 50 mgs, but 1 IU of insulin is .045 milligrams. That's for the pure crystalline versions of those chemicals: a different preparation or a related chemical may have the same effect using a different amount, and that would also be 1 IU.
IU is used for vitamins, hormones, some drugs, vaccines, blood products and similar biologically active substances. Despite its name, the IU is not part of the International System of Units used in physics and chemistry.