What are the two primary purpose of bail?

The first purpose of bail is to provide financial guarantees that the defendant will appear in court.

A secondary purpose in many states is the use of bail to help insure public safety.