When a person is apprehended or in confinement according to law in a county in this State where the jail may be destroyed or rendered uninhabitable by fire or other accident, he must be committed to the jail nearest to the one destroyed for safekeeping. However, the jail must have sufficient bed space. If the jail does not have sufficient bed space, then the official in charge of the jail that was destroyed, or rendered uninhabitable shall contact the facility managers of the jails in the nearest proximity and utilize any available resources to receive and keep the prisoners in custody. The facility managers of this State may enter into mutual aid agreements to assist each other in the event of an emergency or as other needs arise. If sufficient resources are not available within the several counties, then the official in charge of the jail that was destroyed or rendered uninhabitable may request the assistance of the South Carolina Department of Corrections and its resources until the emergency has passed.