To prevent something unpleasant from happening.
To rescue a person or situation from imminent danger or major failure.