Section 38. A sheriff, deputy sheriff or constable, when engaged in the execution of a warrant for the commitment of a person to a penal institution which is not in his own county, shall have the same powers in any county through which he may pass as he would have in his own county in the performance of a similar duty.