"Happy Xmas (War Is Over)" was the culmination of more than two years of peace activism undertaken by John Lennon and Yoko Ono that began with the bed-ins they convened in March and May 1969, the first of which took place during their honeymoon. The song's direct antecedent was an international multimedia campaign launched by the couple in December 1969 – at the height of the counterculture movement and its protests against America's involvement in the Vietnam War – that primarily consisted of renting billboard space in 12 major cities around the world for the display of black-and-white posters that declared "WAR IS OVER! If You Want It – Happy Christmas from John & Yoko". Although this particular slogan had previously appeared in the 1968 anti-war songs "The War Is Over" by Phil Ochs and "The Unknown Soldier" by the Doors (which features the refrain "The war is over"), its subsequent use by Lennon and Ono may just be coincidental; there is no evidence to confirm whether or not they were acquainted with these earlier works.
Recognising the accessibility and popular appeal that made his 1971 single "Imagine" a commercial success compared to the other songs he had released up to that point, Lennon concluded, "Now I understand what you have to do: Put your political message across with a little honey." He conceived "Happy Xmas (War Is Over)" as a means of elaborating upon the themes of social unity and peaceful change enacted through personal accountability and empowerment that served as the basis of the earlier billboard campaign, trying to convey optimism while avoiding the sentimentality that he felt often characterised Christmas songs.
From 1963 to 1969, the Beatles had issued special recordings at Christmas directly to members of their fan club. After the group disbanded in 1970, Lennon was the first former member to release an original Christmas song. "Happy Xmas (War Is Over)" would be followed by George Harrison's "Ding Dong, Ding Dong" (1974), Paul McCartney's "Wonderful Christmastime" (1979) and Ringo Starr's album I Wanna Be Santa Claus (1999).