If the jail of any county is destroyed, or becomes insufficient or unsafe, or any epidemic dangerous to life is prevalent in the vicinity or there be danger of rescue or lawless violence to any prisoner, any circuit court judge may, on the application of the sheriff and proof of the fact, direct the removal of any prisoner or prisoners to the nearest sufficient jail in any other county; and it is the duty of such judge, in such case, to make an endorsement on the order or process of commitment, stating the reason why such removal is ordered, and to date and sign such endorsement.