Why were casualties in Iraq and Afghanistan so much lower than other wars?
There are at least two major reasons for this.
First, these wars have not been fought at the intensity of other wars. Other wars have had major battles that have been fought against opponents who have often had things like tanks and airplanes and artillery. These wars have not been like that. Instead, they have been low-intensity conflicts fought against insurgents with small arms (and with IEDs). Therefore, casualties will be lower.
Second, and very importantly, there have been great advances in medical technology since other wars the US has fought. People who would have died in other wars are now saved due to quick and effective medical treatments.