It shall be lawful for the sheriff of any county of this state, when there shall appear to be no jail, or where the jail of such county shall be insufficient, to commit any person or persons in his custody, either on civil or criminal process, to the nearest jail of some other county; and it is hereby made the duty of the sheriff or keeper of the jail of said county to receive such person or persons, so committed as aforesaid, and him, her or them safely keep, subject to the order or orders of the judge of the court for the county from whence said prisoner was brought.
§ 221.230, RSMo