Magic resistance is an attribute of heroes, similar to armor. Instead of reducing physical damage, it reduces magic damage. All heroes, possess 25% magic resistance from their armor type, but most melee heroes have scaling magic resistance. This percentage is completely independent of their amount of armor.
All Heroes have a basic 25% magic resistance. This means that, by default, for most heroes, all magic damage is reduced by 25%, or only 75% of the ability's damage is dealt. Most non-hero units have a 0% base magic resistance.
There are multiple abilities and items which can increase a unit's magic resistance. These bonuses stack diminishingly, means the higher a unit's magic resistance currently is, the lower the effects of another bonus will be, making it impossible to reach 100% magic resistance. It is also possible to reduce a unit's magic resistance with the help of several abilities. These reductions also stack diminishingly, means the higher a unit's magic resistance is, the less effective magic resistance reductions will get.
However, if a hero has multiple instance of the same item that grants magic resistance, the bonus will only be counted once.