Foreseeability is a legal concept where the legal consequences of an action or failure to take action are limited to those that are reasonably forseeable, not those which actually occurred. In tort law, a tortfeasor is only liable for the reasonably forseeable consequences of their actions. In criminal law, a person is criminally liable for all of the reasonably forseeable consequence of their actions, not just those they directly intended.
One of the classic negligence cases that explores this concept is Palsgraf vs. Long Island Railroad. In that case, a woman standing on a train platform was injured when a case of fireworks being carried by a passenger being helped onto a moving train was dislodged and exploded. The court's ruling was that although the action of the railway conductor in helping a person onto a moving train was negligent, the railroad could not be held responsible for Palsgraf's injury because it was not forseeable that the case the person was carrying could explode and cause injury to bystanders.
In criminal law, a defendant is responsible for the foreseeable consequences of their actions, whether that was what they wanted to happen. For example, shooting someone hoping to wound them is still murder if the victim dies because it was a foreseeable consequence of shooting someone. Shooting at one person and killing someone else is also still murder because it was reasonably forseeable that the bullet could hit someone else. However, hitting someone in the face with your fist and killing them is not murder but manslaughter as that level of force can, but is very unlikely to, result in the death of a person.