SCOTUS routinely holds that the US First Amendment also protects against government-compelled speech. The main case law in this regard deals with a Florida statute that required newspapers to publish a politician's reply to critical articles.
It's not clear to me if this would also extend to a court order requiring someone to publish something, but I think there's going to be some squeamishness as to whether that's a remedy a court can provide. (Obviously, an out-of-court settlement could provide for that).