(a)
(1) The county sheriff of any county in this state, where there is no jail in his or her county or the jail of the county is insufficient, may commit any person in his or her custody, either on criminal or civil process, to a jail in some other county located in this state, provided the county sheriff of the other county consents to receiving the person in custody.
(2) It shall be the duty of the county sheriff or keeper of the jail of the county to receive the person so committed and keep him or her safely, subject to the order of the circuit court of the county in which the prisoner was committed.
(b) It shall be the duty of the county sheriff committing any person to another county for any criminal offense to notify the circuit court judge of the county in which the prisoner is to be tried of the committing of the person to the jail of the other county. The county sheriff shall transmit to the judge at the same time the cause of the capture and detention of the person.
(c)
(1) It shall be the duty of the circuit court judge, at least fifteen (15) days preceding the first day of the next term of the circuit court of the county in which the person is to be tried, to issue a writ of habeas corpus. The writ shall be directed to the county sheriff or keeper of the jail of the county in which the person may be committed, commanding the county sheriff or keeper of the jail to have the body of the person, together with the day and cause of the person's capture and detention, before the circuit court of the proper county for the trial of the offense on the first day of the next term of the circuit court.
(2) It shall be the duty of the county sheriff or jailer to deliver, or cause to be delivered, the prisoner on the day and at the place mentioned in the writ.
(3) Any county sheriff or jailer failing or neglecting to make return of the writ and have there the body of the person, according to the command of the writ, shall be deemed guilty of a contempt and shall be liable to be attached therefor. The county sheriff or jailer shall forfeit to the person or party any sum not exceeding five hundred dollars ($500), to be recovered by the injured party by an action founded on this subchapter.
(d) For committing the person and for executing such writ of habeas corpus, the county sheriff shall be entitled to the same fees as are provided by law for similar services.
(e)
(1) In all cases in which a prisoner is committed from another county for a criminal offense under the provisions of this subchapter, the county shall pay the expenses in the same manner as if the commitment had been in the county where the offense was committed.
(2) In civil suits the plaintiff or defendant shall pay the expenses in the same manner as if the imprisonment had taken place in the county where the suit was commenced.