The sheriff or other officer who legally arrests a person in any county may pass through any other county by the sheriff deemed necessary to convey such person to the place commanded by the process under which the arrest was made.