(a) If it appears by affidavit that the testimony of a person is material in any criminal proceeding and if it is shown that the witness has refused or will refuse to respond to process, the court may require the witness to give bail under § 40-11-117 or § 40-11-122 for appearance as a witness, in an amount fixed by the court.
(b) If the person fails to give bail, the court may commit the person to the custody of the sheriff, pending final disposition of the proceeding in which the testimony is needed, may order the person's release if the person has been detained for an unreasonable length of time, and may modify at any time the requirement as to bail.
(c) If the person does not comply with the conditions of the bail bond, the court having jurisdiction shall enter an order declaring the bail to be forfeited as provided in § 40-11-120 or § 40-11-139.