The ancient Greeks had plays with songs, and Roman comedies included song and dance routines. But the music of these eras disappeared long ago, so they had no real influence on the development of modern musical theatre and film. The Middle Ages brought traveling minstrels and musical morality plays staged by churches, but these had little if any influence on the development of musicals as an art form.
Although there were many musical stage entertainments in the 1700s, none of them were called "musicals." The first lasting English-language work of this period was John Gay's The Beggar's Opera (1728), a ballad opera that reset popular tunes of the day to lyrics that fit a satirical spoof of respectable citizens who are no better than common thieves. This, and other British ballad operas, burlettas and pantomimes, formed the majority of musicals offered on American stages right into the early 1800s.