The American folk custom of wearing or displaying a yellow ribbon to signify solidarity with loved ones or fellow citizens at war originated during the U.S. embassy hostage crisis in Iran in 1979. It does not have a connection to the American Civil War, beyond the use of the old British folk song "Round Her Neck She Wore A Yellow Ribbon" in the John Wayne movie of the same name, with a Civil War setting, released in 1949. The story of a ribbon tied to a tree as a signal to a convict returning home that his loved ones have forgiven him is attested from 1959, but the ribbon in that case was white.
The ribbon color seems to have changed to yellow first in a version retold by newspaper columnist Pete Hamill in 1971. The story was dramatized in June 1972 on ABC-TV (James Earl Jones played the ex-con). Later that year, Irwin Levine and L. Russell Brown copyrighted the song "Tie a Yellow Ribbon Round the Ole Oak Tree," which became a pop hit in early 1973 and sparked a lawsuit by Hamill, later dropped.
In 1975, the wife of a Watergate conspirator put out yellow ribbons when her husband was released from jail, and news coverage of that was noted and remembered by Penne Laingen, whose husband was U.S. ambassador to Iran in 1979 and one of the Iran hostages taken in the embassy on Nov. 4. Her yellow ribbon in his honor was written up in the Dec. 10, 1979, "Washington Post." When the hostage families organized as the Family Liaison Action Group (FLAG), they took the yellow ribbon as their symbol. The ribbons revived in the 1991 Gulf War and again during the 2003 wars in Afghanistan and Iraq.