It is rather a way of securing a defendant's agreement to abide by certain conditions and return to court. In that sense, bail is like collateral left with the court to ensure that, after the defendant's release from jail, he or she will return for the remaining parts of the criminal case.
Bail is a way to allow you to get out of jail between the day you were arrested and the day your trial is set for. This gap can be months or even years, so people don't want to spend that time in jail when they plan on fighting a case.