Interesting question, I'll try to answer.
First, you have to realize that anytime you use military force, there will be casualties. People will die. .
The next thing you have to decide is whether or not the use of military force is justified and what would be the consequences of not participating?
In the case of Iraq, if the U.S. were to pull out, what would happen? In all likely hood, Iran would send in people and attempt to take over Iraq. In the process, anyone who was perceived as helping the US would be killed. The people who live there would be helpless to resist or fight.
Historically, you need to look at similar situations in history. Consider Viet Nam. After we left, tens of thousands of American supporters, who believed in freedom for their country were either killed or sent to North Vietnamese "Re education camps" In Cambodia, millions were killed by Pol Pot and his regime. .
Such will be the cost if America pulls out of Iraq. Additionally, it will embolden the terrorist factions and result in significantly more terrorist acts world wide. The terrorists will point out that America is a paper tiger and can be defeated through terrorism
As it stands now, most terrorists (Muslim such as al Queida) are tied up fighting in Iraq. In fighting them on their front, we prevent their coming and fighting on our soil. So you have to ask. . Is it better to fight terrorism on their front and OUR conditions or let them come here and fight on their terms?