In the law of the United States, the phrase "clear and present danger" reflected a test which was used in courts to determine whether or not laws restricting speech were constitutional until 1969, when it was replaced by the concept of "imminent lawless action." In a nutshell, it was determined that if speech created a clear and present danger to public safety, it would not be considered legally protected free speech. In such cases, the government would be within its rights to limit it.
This phrase comes from Schenck v. United States, 249 U.S. 47 (1919), a case in which the restrictive laws about "subversive activities" enacted in response to the First World War were challenged. In this case, a man who distributed antiwar pamphlets to men of draft age claimed that he had a right to do so because the pamphlets were protected under free speech law. Writing for the Supreme Court, Justice Oliver Wendell Holmes, Jr. disagreed, stating that the government did in fact have a right to regulate speech which posed a clear and present danger to safety. The example he used was shouting "fire" in a crowded theater when no fire was present; he believed that wartime restrictions on speech were reasonable since it was a national security matter.
This concept was applied to a number of cases between 1919 and 1969 in which people ran afoul of laws designed to limit free speech in the interests of public safety. Doing things like inciting riots or lynch mobs and publishing the identities of secret agents were considered a clear and present danger because they posed a risk to individual people and/or national security.
Although the concept of clear and present danger played an important role in American law, over time the government's approach to speech began to evolve. The Supreme Court and other legal advocates began to argue more in favor of fewer restrictions on speech. They argued that the government could not suppress dissent, although it still had a right to limit speech which could lead to immediate lawlessness or physical harm.
With Brandenburg v. Ohio 395 US 444 (1969), the concept was changed to "imminent lawless action." In this case, speech such as handing out antiwar pamphlets would have been protected, but inciting illegal activity which could occur before law enforcement had an opportunity to respond would not be protected. Thus, situations like speeches to incite lynch mobs could still be limited under the law.