I have wondered this question for a long time. The metal armor has enjoyed its heyday through the early human warfare history right into the renaissance. Then guns and cannons entered the fighting scene and all the sudden, soldiers were only wearing uniform onto the battle field. Compare with cotton fabric, metal armor can withstand more damage. Compared to arrows and sword cuts, bullet and cannon balls were more devastating, weren't there even more reasons for soldier to wear metal armor?
As the Metropolitan museum's article on armor notes, it took several centuries from the first introduction of gunpowder on the battlefield to the elimination of armor for the infantry man.
The decline took the form of a gradual shedding of armor from the arms and legs and then finally from the body. The main reasons for this decline were weight and cost.
In theory it was possible to make armor capable of stopping a musket bullet. However, as firearms became more powerful (thanks to better manufacturing, which reduced windage, and improvements in the formulation of gunpowders) the armor required for protection got thicker and, therefore, heavier and more expensive. Heavier armor meant that your soldiers were less mobile and would suffer fatigue more quickly, neither of which is an advantage on the battlefield (or even getting to the battlefield).
Ultimately, of course, no amount of personal armor would be capable of stopping a cannon ball (or even something as small as a 1-pound grape-shot) so even a bulletproof armour was no guarantee of safety.
One of the advantages of the musket was that it required relatively little training (compared to a bow or a sword) to be an effective weapon. This meant that armies could be raised from lower-class men with comparatively little training (who were free to work on the land in times of peace). These men could not have afforded to equip themselves with armor, so this cost would have fallen on whomever was raising the army. The sad fact is that it became cheaper to replace the soldier than it was to provide armor to protect him from the enemy's small arms fire.
I agree with the answer of Steve Bird, but I want to mention one more aspect of this. Body armor was not suddenly eliminated. It was still widely used in 17th century, and later.
is the Polish hussar armor of late 17 century, very long time after the introduction of firearms.
But body armor was EXPENSIVE. With increase of the size of the armies, and general social changes, the soldiers could not be expected anymore to buy it for themselves, and giving it to them was prohibitively expensive. It is not surprising that body armor first disappeared in infantry, and remained in cavalry. There was some limited use of body armor even in WWI (it can really protect you from shell splinters which were a major cause of combat deaths and wounds.)
You can find many more on the internet.
But it was too expensive to provide soldiers with it. So they limited themselves with helmets.
Notice that nowadays when the armies became much smaller again, the body armor (bullet proof vests) is widely used.
Why wear it when you can ride it?
Just look at all these lumbering hunks of armour on the battlefield:
Over time, people began to realise that riding vehicles with armour served way much better than having each person wear armour as a person can only carry so much armour. Vehicles (or even a massed groups of people) on the other hand, can carry way more armour which can stop gunpowder-fired projectiles.
It is not that soldiers quit using armour, the armour changed platforms.
Because armour that would protect the whole body from muskets would be so heavy you could barely move. This would put you at a severe tactical disadvantage. Lighter missile troops could pepper you until they found a weakness and if you try to attack them they'll run away. Repeat until you're exhausted.
By dropping some, and eventually all, armour you become fast enough to close before they can get too many shots off.
Even as far back as the Battle of Agincourt in 1415, in pre-firearm times, metal body armor turned out to be a drawback, not a benefit. Thanks in part to the sea of mud in the battlefield, the armored French knights on foot were slowed up, and the powerful Welsh longbow could penetrate main armor at 20-30 yards, or appendage (arm, leg) armor at up to 200 yards. The slow moving French foot soldiers were slaughtered because they couldn't get close enough to Henry's longbowmen to employ their swords. The French mounted cavalry wearing very heavy armor often drowned in the mud when the arrows hit their horses and they fell off. A mounted knight, once dismounted, was pretty much immobile, due to the extreme weight of their armor.
The key here was the introduction of a powerful weapon that could strike at a distance with enough force to penetrate wearable metal armor, thus invalidating the primary reason for armor: protection against a sword or spear at close range. As Agincourt showed, a fast moving unarmored soldier with a long range weapon handily bested a slower moving armored soldier.
The introduction of the musket, that could do what the longbow could do but with far less training, finally obsoleted metal body armor.
However... personal armor has made a comeback in the last 30 or so years, thanks to lightweight composite armor that can resist the typical rifle bullet. Most of the advanced militaries today equip their foot soldiers with body armor, and that is one reason that casualties have dropped for the more modern militaries.