It’s a risk/benefit calculation.
Soldiers do it. Physicians do it. Politicians do it. Pilots do it. Policeman do it. Parachutist, animal trainers, racing drivers, SCUBA divers… it is a very long list.
The largest example that comes to my mind of intentional endangerment everyone by nuclear weapons development and stockpiling, with the objective of preventing nuclear war. It is well known, that we have come close to launching, on one side or the other, more than once.
Another one, is the pollution that each of us creates when we act as consumers in our industrialized society.
How about the parent who dies younger than otherwise, from the stress of working to support a family?
The challenge is to have the moral clarity to make the analysis. A suicide bomber, very definitely intends to endanger his/her life, and the lives of others. In my view, any intentional killing of noncombatant civilians is immoral. However, there are plenty of people who applaud the behavior as being for the good.
Another more difficult problem for me morally, is that of collateral damage. Assuming, for the moment, that a war is just, then if one fights that war, one knows that innocent people will be harmed. Targeting is more accurate than it has ever been before, and a good deal of time is spent for planned attacks to minimize innocent loss. But nothing is perfect, and mistakes in judgement or perception do occur.