(a) When any convict is sentenced to the penitentiary, the judge of the court in which the sentence is rendered shall order the inmate to be confined in the nearest secure jail. The clerk of the court shall at once notify the Department of Corrections as to the jail where the inmate is confined, forward to the department a copy of the judgment entry and sentence in the case, and inform the department if any special care is necessary to guard the inmate. Thereupon, the department shall direct where the inmate shall be taken for confinement or hard labor.
(b) When an inmate sentenced to the custody of the department and the department is in receipt of a transcript of such sentence, is being housed in a county jail, and the inmate develops a medical condition which requires immediate treatment at a medical-care facility outside the county jail, the department shall be financially responsible for the cost of the treatment of the inmate. The department shall receive any contractual discounts the medical-care facility has agreed to grant for the treatment of inmates housed in state correctional facilities. When an inmate sentenced to the custody of the department and the department is in receipt of a transcript of such sentence, is housed in a county jail, and the inmate develops a medical condition or has been diagnosed as having a medical condition which, in the opinion of a physician licensed in Alabama, would require treatment or a medical procedure or both, involving a cost of more than two thousand dollars ($2,000), the inmate shall be transferred within three days to a state owned or operated correctional facility or to the physical custody of the department as determined by the Commissioner of the Department of Corrections. The inmate shall receive treatment in the same manner as other state inmates. Nothing in this subsection shall be interpreted to relieve the department of its responsibility for the maintenance and upkeep, including the payment of medical costs, of an inmate sentenced to the custody of the department, nor shall this subsection be interpreted as conferring any additional responsibility upon a county for the maintenance and upkeep, or the payment of medical costs, of any inmate sentenced to the custody of the department.