Folk music historian Gary Theroux explains the origin of this song:
Pete Seeger and Lee Hays were founding members of People's Songs, a music publishing company that specialized in tunes that supported various left wing causes - including hammer and sickle Communism. At its first board of directors meeting, Seeger and Hayes staved off boredom by passing a sheet of paper back and forth, collaborating on the lyrics that became "If I Had A Hammer." That Labor Day, at a show promoted in a Communist newspaper, Seeger debuted the song in concert (his co-star on the bill was Paul Robeson). Impressed by the crowd reaction, Seeger and Hays then recorded "If I Had A Hammer" with their new group, The Weavers, as their first release on the tiny Charter Records label. (Ronnie Gilbert and Fred Hellermen rounded out the quartet). "It was a collector's item," said Hayes. "Nobody but collectors ever bought it."
In 1952, the lyrics were revised a bit by a fellow radical activist, Libby Frank, who insisted on singing "my brothers and my sisters" instead of what Seeger and Hayes had written: "all of my brothers." Hayes objected ("It doesn't ripple off the tongue as well. How about 'all of my siblings?") but finally agreed. A decade later, the melody itself was rewritten by Peter, Paul & Mary. Most people nowadays sing it as they heard it on PPM's record, admitted Seeger. This Peter, Paul & Mary version reached #10 in October 1962.
A Latin-tinged interpretation, recorded live at PJs nightclub in Hollywood, became an even bigger hit (#3) for Trini Lopez the following September. (This first appeared in the Forgotten Hits newsletter.)
Thanks to his populist, pro-union songs, Seeger got some ink in a newspaper called the Daily Worker, which was distributed around New York City. The paper was published by an organization called Communist Party USA, which became an obvious target for the House Un-American Activities Committee, which was a congressional committee devoted to purging domestic communism.
Seeger was called to testify before the committee on August 18, 1955, and this song became a topic of questioning. Chief Counsel Frank Tavenner produced a copy of the Daily Worker from June 1, 1949 that read:
The first performance of a new song, "If I Had a Hammer," on the theme of the Foley Square trial of the Communist leaders, will be given at a testimonial dinner for the 12 on Friday night at St. Nicholas Arena. Among those on hand for the singing will be Pete Seeger and Lee Hays.
Tavenner questioned Seeger about the performance, to which Seeger replied, "I am not interested in carrying on the line of questioning about where I have sung any songs."
Seeger was then asked if he had entertained at communist functions, at which point he gave this famous reply:
I have sung for Americans of every political persuasion, and I am proud that I never refuse to sing to an audience, no matter what religion or color of their skin, or situation in life. I have sung in hobo jungles, and I have sung for the Rockefellers, and I am proud that I have never refused to sing for anybody.
Asked to answer the question directly, Seeger added:
I am proud that I have sung for Americans of every political persuasion, and I have never refused to sing for anybody because I disagreed with their political opinion, and I am proud of the fact that my songs seem to cut across and find perhaps a unifying thing, basic humanity, and that is why I would love to be able to tell you about these songs, because I feel that you would agree with me more, sir. I know many beautiful songs from your home county, Carbon, and Monroe, and I hitchhiked through there and stayed in the homes of miners.
Seeger was sentenced to a year in prison for contempt, but never served the time as the verdict was reversed in 1962. As a result of the sentence, Seeger was not welcome on network television until years after the reversal. ABC, NBC and CBS were beholden to congress for their broadcast licences, so it was in their best interest to keep Seeger off the air.