A judge has given Avenal and Pleasant Valley State Prisons one week to start moving inmates at risk of coming down with valley fever.
U.S. District Judge Thelton Henderson gave seven days to begin and 90 days to finish the transfers.
Monday's ruling also criticized the governor for delaying improvements to prison health care programs, after 36 prisoners have died in the past six years.
Joyce Hayhoe, legislative director for the California Correctional Health Care Services said, "The State of California has spent well over $23 million to treat inmates that come down with valley fever. So we see this not only as a public health response to Valley fever, but also a way to save money."
More than 3200 inmates are covered in the ruling, including those with HIV and diabetes, as well as African Americans and Filipinos.