Defense lowers the damage your units take from any source. The more Defense your unit has, the less damage it will take when attacked.
Every 10 points of Defense require that a Unit take 1% more of its maximum health in damage to be killed.
For example, if you increased a Unit's Defense by 1,000, you are effectively increasing its health by 100%.

In detail:
The Health of a Unit after factoring in Defense is its Effective Health. The formula is as follows:
Effective Health = (1+Defense/1,000) x Health
For example, the Cannoneer Tech "Camouflaged Guns" gives your Rocket Launcher, Artillery and Self-Propelled Artillery 250 Defense vs. Bombers when maxed. This means that in effect those units would have 25% more HP when attacked by Bombers.