When the party has been committed upon a criminal charge, unless the court deems it unnecessary, a subpoena shall also be issued to summon the witnesses whose names have been endorsed upon the warrant of commitment, to appear before such court at the time and place when and where such order of habeas corpus is returnable, and it shall be the duty of the sheriff, or other officer to whom the subpoena is issued, to serve the same, if it is possible, in time to enable such witnesses to attend.
735 ILCS 5/10-109