It's not about what the church requires, it's about "religious beliefs" and practices. Many nuns no longer wear habits, but others do, and consider it important. Would a judge order them to remove it? I don't think so.
Even the title says "headscarf" - the hijab doesn't cover the face, or obscure identity. To the judge, it's about respect, like removing a hat to pledge allegiance, and most judges are sticklers for being respected in their courtrooms.
Still, I'd like to see some spirited [and principled] nun show up in a wimple, and see if the judge orders her to remove it.
Another example of how freedom of religion and the supremacy of religious beliefs takes a back seat when the religion isn't one's own.