The Supreme Court has struck down a law mandating that nonprofit organizations adopt a policy opposing prostitution as a condition for receiving federal funds for HIV/AIDS programs abroad, saying such a requirement violated the groups' free-speech rights.