I'm sure there's a team of lawyers that pored over the exact language used and made sure it skirts the laws; they say "we strongly encourage", not "we prefer".
They're equivalent. People strongly encourage things they prefer. It would be a very Kafkaesque judgement that one can strongly encourage a certain gender to apply and not violate that statute.
Of course, it's also the outcome I'd expect, but biased application of the law is a separate issue.
I agree with the other person who replied. Couldn't they also say that they need women for pat downs of women, etc? So they have a legitimate reason for encouraging women to apply?