Fairy-tale films, filmové pohádky, hold a special place in Czech culture. It started in the 1950s when filmmakers turned to adapting fairy tale stories into films as a way to escape the harsh censorship of the Communist Party. The first feature-film fairy tale was Pyšná princezna (The Proud Princess) from 1952, directed by Bořivoj Zeman. Even though it was highly ideological, it became the most-watched Czech film of all time.
In the 1960s, the censorship was growing more lenient, and the Czechoslovak New Wave affected fairy tales, too. Directors were experimenting with genre and playing with established tropes. Many popular fairy-tale films implement elements of comedy. It has become a tradition to watch these classic pohádky during Christmastime, and since 1993, the Czech public-service broadcaster Česká televize releases a new fairy-tale film every Christmas Eve (and there would probably be public outrage if they didn't).
This song comes from the comedy musical fairy tale Šíleně smutná princezna (The Insanely Sad Princess), written and directed by the same Bořivoj Zeman who directed The Proud Princess. Ivo Fischer wrote the text, and the music was composed by Jan Hammer, Jr., who received several Grammy Awards after he emigrated to the US shortly after the invasion, and is known for theme music of the TV series Miami Vice.
The film was released in June 1968, and stars two of the biggest pop-culture idols of the time, later members of the group Golden Kids, Helena Vondráčková and Václav Neckář (whom you may know from the Oscar-winning film Closely Watched Trains). They play Princess Helena and Prince Václav, who were promised to each other as babies by their fathers, King Dobromysl and King Jindřich, to ensure peace between the two kingdoms. Both Helena and Václav despise the idea of an arranged marriage, and on the way to King Dobromysl's castle, Václav escapes his father's entourage. He accidentally enters the castle garden and meets Helena, but because they're both dressed plainly, it doesn't occur to them that the other may be the king's child.
They fall in love, and in an effort to make her father change his mind about the arranged marriage, they conspire on a plot inspired by a classic fairy tale, The Sad Princess (sometimes called How Honza Made the Princess Laugh). Unfortunately, the King has not read it...
The film creators took quite a few jabs at the regime, which were then disappeared for twenty years. For example, this exchange between the two kings' respective advisors, Iks and Ypsilon:
Y: We must take further...
I: Intrigues?
Y: Yuck! Steps in the common interest.
I: That's the same thing.
Y: But it sounds better.
Their duet Kujme pikle (Let's Conspire) was among the things that were cut out during the post-1968 "normalization", and it only returned after 1989.
You can read more about Czech fairy-tale films here; there's a Czech, Simple Czech, English, and Russian version of the article. The whole website is worth taking a look at; it collects information about Czech cultural and linguistic heritage and is funded by the Ministry of Culture.