The judge found that putting women in men's prison puts them in danger.