EDIT: People assuming that I'm against all kinds of such regulations: cut that out, I never claimed that.
That might be a moral problem for libertarians. But there are lots of (not only German) laws along these lines.
Not participating in a transaction is a personal issue, which doesn't need justification. Not letting others participate in it should need to be very well justified, at least in a State that is supposed to be democratic and just.
Personally, and in this particular case, I find the justification lacking.
The law is there to protect individual citizens against the ruthless exploitation by major corporations like Facebook.
Especially when those corporations hold the key to either social isolation or abandoning your civil rights. The laws are there to prevent companies from abusing their power from effectively undermining individual people's rights and freedoms.
Anonymous idiots spouting off, oh my...
Company proceeds to only hire men, despite women with similar or better qualifications applying. Company then sued for obvious gender discrimination, illegal in the US.