I don't know how that could happen.
>>Could a judge really compel you to do that?
No, but if you didn't do it and the purpose of doing the action in the first place was to be able to violate a gag order you would be violating that order. So at that point you would have to decide between breaking the law or being deceitful. The judge wouldn't have to order you to do anything.