The scenes represent a hallucination by Dr Walter Bishop, played by John Noble.
However, producer Jeff Pinkner admitted that the writers had not expected to include singing and dancing in the episode.
"We didn't set out to do a musical," he told Entertainment Weekly. "We set out to do an episode that explored Walter's state of mind - he's dealing with some very upsetting news."
Pinkner continued: "When we realised that the way Walter would deal with such news would be to try to anaesthetise himself with copious amounts of marijuana, well, singing and dancing became a natural outcome."
He also revealed that Anna Torv's character Olivia will feature heavily in the episode, adding: "It'll be interesting to see how Walter really perceives her."