...this actually happened?
It is a violation of the Facebook TOS to 'access an account belonging to somebody else'. (So if you trade Facebook passwords with your partner you're actually violating the Facebook TOS). It is specifically against the rules to 'solicit login information'. It is completely unethical for any judge to order that an individual break a company's terms of service.
As for the wider implications...wow. Just wow. Any divorce lawyer worth their salt warns you to separate all jointly held accounts, financial and otherwise. Although many divorces are amicable, many are not. An ex with access to your Facebook can ruin your chances of future employment (Ever tried deleting anything from Facebook?), future relationships...you can really sabotage somebody that way.
Tell me this is a joke and a judge didn't actually try this.
Edited...not a joke. Found the news article. Wow. Just...wow.