How did "bail" shift to signify "money deposited as a guarantee when released"?

Solution 1:

A “bailor” under the common law of contract is “one who takes possession of and responsibility for a piece of property, and is liable to the owner of the property (the bailee) if it is lost or damaged while it is in their possession. “Bail” applies that concept to criminal legal proceedings.

The person who posts bail for a defendant is pledging an amount of money in order in exchange for possession of a prisoner. The party posting the bail is the “bailor” and the criminal justice system is the “bailee.” The bailor has pledged that the defendant shall be returned to the court, and if the bailor fails to ensure the return of the defendant to court, then they surrender the security that they pledged to the court in satisfaction of the liability that they assumed when they took possession of the defendant.