Mussorgsky wrote several versions of the work. He originally had an idea for an opera based on a story written by Gogol titled St. John's Eve. that involved witchcraft. He later considered writing a different opera based on a play by his friend Baron Georgiy Mengden titled The Witch. Mussorgsky wrote of his idea for the opera in a letter to his mentor Balakirev:
I have also received some highly interesting work which needs to be prepared for the coming summer. This work is: a whole act on The Bald Mountain (from Mengden's drama The Witch), a witches' sabbath, separate episodes of sorcerers, a ceremonial march of all this rubbish, a finale—glory to the sabbath... The libretto is very good. There are already some materials, perhaps a very good thing will come of it.There is no existing music for either planned opera. Mussorgsky then decided to write a tone poem for orchestra that incorporated the ideas from both planned operas. In turn, the written works that inspired the tone poem were themselves based on folk legends, of which Mussorgsky writes about in a letter to Vladimir Nikolsky, a professor of Russian history and language:
So far as my memory doesn't deceive me, the witches used to gather on this mountain, ... gossip, play tricks and await their chief—Satan. On his arrival they, i.e. the witches, formed a circle round the throne on which he sat, in the form of a kid, and sang his praise. When Satan was worked up into a sufficient passion by the witches' praises, he gave the command for the sabbath, in which he chose for himself the witches who caught his fancy. So this is what I've done. At the head of my score I've put its content: 1. Assembly of the witches, their talk and gossip; 2. Satan's journey; 3. Obscene praises of Satan; and 4. Sabbath ... The form and character of the composition are Russian and original ... I wrote St. John's Eve quickly, straight away in full score, I wrote it in about twelve days, glory to God ... While at work on St. John's Eve I didn't sleep at night and actually finished the work on the eve of St. John's Day, it seethed within me so, and I simply didn't know what was happening within me ... I see in my wicked prank an independent Russian product, free from German profundity and routine, and, like Savishna, grown on our native fields and nurtured on Russian bread.Mussorgsky sent the finished score to Balakirev and was mortified when his mentor severely criticized the work, and refused to perform it. Mussorgsky continued ot revamp the music, first in the opera Mlada, another planned work that was never written, and yet again in another opera The Fair At Sorochyntsi, a work that was still not finished when Mussorgsky died in 1881. The original score had to wait for its first performance until the 20th century after the manuscript was found in the Leningrad Conservatory in the 1920's. After a handful of performances the work languished further until the 1960's when it began to be played occasionally.
Mussorgsky's original tone poem compared to Rimsky-Korsakov's work is more fragmented and can sound rather crude. But the music fits the subject matter, as Mussorgsy makes up for his lack of compositional technique with brilliant orchestral colors and powerful effects. Below is a video of Mussorgsky's original, along with a video of Rimsky-Korsakov's version for comparison.