When the court orders the prisoner to be carried to the jail of another county for safekeeping for want of a sufficient jail in the county where the case is pending, it may make a reasonable allowance to the sheriff and necessary guard, including expenses for conveying the prisoner to the jail so ordered by the judge.