(a) A judge of a state court of record in another state which by its laws has made provision for commanding persons confined in penal institutions within that state to attend and testify in this state may certify that there is a criminal proceeding or investigation by a grand jury or a criminal proceeding pending in the court, that a person who is confined in a penal institution in this state is a material witness in the proceeding or investigation, and that the witness's presence will be required during a specified time. Upon presentation of the certificate to any judge having jurisdiction over the person confined and upon notice to the Attorney General, the judge in this state shall fix a time and place for a hearing and shall make an order directed to the person having custody of the prisoner requiring that the prisoner be produced before him or her at the hearing.
(b) If at the hearing the judge determines that the witness is material and necessary, that the witness attending and testifying are not adverse to the interest of this state or to the health and legal rights of the witness, that the laws of the state in which the witness is required to testify will give the witness protection from arrest and the service of civil and criminal process because of any act committed prior to the witness's arrival in the state under the order, and that as a practical matter the possibility is negligible that the witness may be subject to arrest or to the service of civil or criminal process in any state through which the witness will be required to pass, the judge shall issue an order, with a copy of the certificate attached, directing the witness to attend and testify, directing the person having custody of the witness to produce the witness in the court where the criminal proceeding is pending or where the grand jury investigation is pending at a time and place specified in the order, and prescribing such conditions as the judge shall determine. The judge, in lieu of directing the person having custody of the witness to produce the witness in the requesting jurisdiction's court, may direct and require in the court's order that the requesting jurisdiction shall come to the Georgia penal institution in which the witness is confined to accept custody of the witness for physical transfer to the requesting jurisdiction; that the requesting jurisdiction shall provide proper safeguards on the witness's custody while in transit; that the requesting jurisdiction shall be liable for and shall pay all expenses incurred in producing and returning the witness, including, but not limited to, food, lodging, clothing, and medical care; and that the requesting jurisdiction shall promptly deliver the witness back to the same or another Georgia penal institution as specified by the Department of Corrections at the conclusion of his or her testimony.
(c) The order to the witness and to the person having custody of the witness shall provide for the return of the witness at the conclusion of his or her testimony, proper safeguards on his or her custody, and proper financial reimbursement or prepayment by the requesting jurisdiction of all expenses incurred in the production and return of the witness and may prescribe such other conditions as the judge thinks proper or necessary. If the judge directs and requires the requesting jurisdiction to accept custody of the witness at the Georgia penal institution in which the witness is confined and to deliver the witness back to the same or another Georgia penal institution at the conclusion of the witness's testimony, no prepayment of expenses shall be necessary. The order shall not become effective until the judge of the state requesting the witness enters an order directing compliance with the conditions prescribed.
(d) This Code section shall not apply to any person in this state confined as insane or mentally ill or under sentence of death.