Every able-bodied prisoner over eighteen and not more than fifty years of age confined in any jail under the judgment of any court authorized to imprison upon conviction for the violation of any law of this state, an ordinance or bylaw of any municipality, or civil township, or any rule or regulation of any board, commission, or public officer having the effect of law, may be required to labor during the whole or some part of each day of his sentence, but not more than eight hours in any one day. Such court, when passing judgment of imprisonment, shall determine and specify whether such confinement shall be at hard labor or not. Such labor may be in the jail or jailyard, upon public roads or streets, public buildings, public grounds, or elsewhere in the county.
SDCL 24-11-28