Answer by taking a quote from the following article:

Carousel is the second musical by the team of Richard Rodgers (music) and Oscar Hammerstein II (book and lyrics). The 1945 work was adapted from Ferenc Molnar's 1909 play Liliom, transplanting its Budapest setting to the Maine coastline. The story revolves around carousel barker Billy Bigelow, whose romance with millworker Julie Jordan comes at the price of both their jobs. He participates in a robbery to provide for Julie and their unborn child; after it goes tragically wrong, he is given a chance to make things right.

A film version of the musical was made in 1956, starring Gordon MacRae and Shirley Jones. It follows the musical's story fairly closely, although a prologue, set in the Starkeeper's heaven, was added. The film was released only a few months after the release of the film version of Oklahoma!. It garnered some good reviews, and the soundtrack recording was a best seller. As the same stars appeared in both pictures, however, the two films were often compared, generally to the disadvantage of Carousel. Thomas Hischak, in The Rodgers and Hammerstein Encyclopedia, later wondered "if the smaller number of Carousel stage revivals is the product of this often-lumbering [film] musical".  There was also an abridged (100 minute) 1967 network television version that starred Robert Goulet, with choreography by Edward Villella.  The New York Philharmonic presented a staged concert version of the musical from February 28 to March 2, 2013, at Avery Fisher Hall. Kelli O'Hara played Julie, with Nathan Gunn as Billy, Stephanie Blythe as Nettie, Jessie Mueller as Carrie, Jason Danieley as Enoch, Shuler Hensley as Jigger, John Cullum as the Starkeeper, and Kate Burton as Mrs. Mullin. Tiler Peck danced the role of Louise to choreography by Warren Carlyle. The production was directed by John Rando. Charles Isherwood of The New York Times wrote, "this is as gorgeously sung a production of this sublime 1945 Broadway musical as you are ever likely to hear." It was broadcast as part of the PBS Live from Lincoln Center series, premiering on April 26, 2013.

which version came out after the musical?
A film version of the musical was made in 1956,