bail out: abandon a project; leave abruptly
The first people to bail out were airplane pilots, beginning in the 1920s. Sometimes the term was spelled bale out, as in this example from the 1939 book Pilot's Summer: "If you bale out and land in water . . ." This spelling suggests the pilot dropping straight down like a bale of hay being tossed from the loft.
By the 1940s, bail out was being used figuratively to describe an escape from unpleasant situations. It then entered youth slang by way of sixties surfing jargon. Surfers used the term to mean deliberately jumping off a surfboard to avoid wiping out, or crashing. Eighties Valley Girl jargon, which relied heavily on surfing terms, then adopted bail to mean leave, as in "Let's bail."
It's unclear whether this kind of bailing out is connected to financial bailouts. Rescuing failed companies may come closer to the legal term bail out, in use since the sixteenth century to mean releasing someone from arrest. This bail comes from an old French word for taking charge or control, which makes more sense for bailed out companies. On the other hand, it's also a way for companies to leave the scene of a potential disaster.