Here is a little more information on how the music became connected to Ibsen's play:
"The Peer Gynt Suite was first composed by famed Norwegian composer Edvard Grieg (1843-1907) in the year 1876. All eight songs are an effort to put a musical interpretation to Henrik Ibsen's play by the same name, which was written about a decade earlier in 1867. The play is approximately 5 Acts (dependent on which version you follow) and spans from Norway to Morocco to Egypt before returning home. The play has surprisingly few principal characters, but of course all action follows the tragic (and possibly delusional) Peer Gynt in his travels and deeds. Supporting roles are filled by his mother Aase, a plain girl Solveig who is his faithful love, a young bride Ingrid, The Troll King, and finally the play's "judge" of humanity, the Button Molder. The play is quite entertaining, with several ending altering plot twists."