Companies probably aren't doing this to discriminate
They are doing it to maximize their advertising dollar. If you are advertising for an oil field worker, you are getting far less of your money's worth by advertising to women, or to men over say 50 years old. Likewise you wouldn't want to advertise a wildcatter job to people with a college degree, people who live in NYC, or single parents. Your advertising dollar goes a lot further advertising towards those more likely to be interested.
Maybe Facebook should turn it around and let people register their interest in certain types of jobs, and everyone who registers themselves as interested in oil industry jobs will be the only ones who see such jobs. Of course they wouldn't want to do that - they'd rather you have to spend 100x as much to hit the 1 in 100 people who are interested. If you aren't allowed to discriminate then you'd have to spend 200x as much to hit the 1 person who interested - so forcing Facebook to do this is only going to make them more money!