It is perfectly legal: there is no law requiring an employer to tell employees about any criminal background, including sex offenses, of any other employees. The law simply does not impose that obligation (to inform employees of  their coworkers's past offenses) on employers. Therefore, they did not have to tell you this, and can give you a bad reference for walking out on your job.