A county inmate shall not be allowed to work on any public work or improvement whenever there may be danger of his or her escape, nor shall he or she be compelled to labor at any kind of business or in any avocation that would tend to impair his or her health or strength.