The social media company challenged the law on the grounds it violated free speech rights under the First Amendment, but the court rejected the arguments.