Boxing can be considered one of the foundations of Krav Maga. Imi Lechtenfeld, the founder of Krav Maga, was an international athlete representing Hungary in Boxing, (in addition to gymnastics & wrestling) the 1930's.
Imi used his boxing experience to defend himself, friends and family against anti-Jewish violence against Jews pre-WWII. Out of necessity he worked out what worked in practice and stripped away what did not. Later this practical experience formed the basis of his knowledge when formalising the techniques and principles for what is now know as Krav Maga (more about Imi)
In Krav Maga our stances and punching strikes are very similar to boxing and we incorporate punch combinations similar to boxing in training. We also make extensive use of pads and bags to refine our hard striking just like in a boxing gym.
However, boxing is is a rules based, 1 against 1, competition with opponent of similar size, contested in a ring with a referee. Opponents are trying to either get more strikes in on each other other in the allotted number of rounds, or ultimately knock each other out.
Krav Maga prepares you for situations with no rules (although we must operate within the bounds of the law). In Krav Maga we can make attacks to the attackers' vulnerable points suck as groin, eyes, or other sensitive areas to give ourselves the best chance to defend ourselves without getting hurt (see Imi quote below). Moreover, Krav Maga training must incorporate many more situation variables to prepare us for real life.
Therefore, Krav Maga will get you in shape like boxing, but the training is very dynamic with lots of variables and simulations incorporated into classes. (more about Krav Maga techniques).
Counter-attacking to vulnerable points means a small defender can defeat a large attacker
Imi Lechtenfeld - Founder of Krav Maga