This question came up because I was curious if the likes of Bach and Beethoven had heard Middle Eastern or Indian scales. Specifically, I noticed the use of a major third to a phrygian second, which is often used in Middle Eastern music, in Beethoven's Sonata Op. 28. Am I making false connections or were some composers occasionally influenced by other cultures' music?
Sort of. John MacKenzie, in his book Orientalism: History, Theory and the Arts identifies two main sources of exotic musical influence (at least in the context of Orientalism) in the seventeenth and eighteenth centuries: the Ottoman Empire and the Islamic-influenced music of Spain and Portugal. For an example of the somewhat Andalusian influence on a major Baroque composer, check out Domenico Scarlatti's Sonata in D major (K.492).
But it was really the Ottoman Empire that exerted the most musical influence, with European interest in Ottoman fashion and culture culminating in the phenomenon known as turquerie (roughly "Turkishness"). However, it is very important to note that composers were far more influenced by their own idea of what Ottoman music sounded like than by the real forms that it took; it was typically sprightly and minor in color, with martial passages allegedly influenced by Janissary bands. Here's Eve R. Meyer, quoted in Nasser al-Taee's Representations of the Orient in Western Music: Violence and Sensuality:
The main function of most Turkish musical performances was to give sensuous pleasure. In France, during the reigns of Louis XIV and his successors, the appetite for Oriental exoticism developed to such an extent that there was hardly an entertainment without at least one. Turkish interludes were often inserted in ballets and in a new dramatic form called opera-ballet, which was initiated with Campra's L'Europe galanta (1696)—a series of tales involving love and jealousy in France, Spain, Italy, and Turkey. [...] Turquerie attained such popularity that Turkish scenes were often inserted in operas, ballets, and plays that had nothing whatever to do with the Orient.
Probably the most famous instance of musical turquerie is Mozart's Rondo alla turca, from his Piano Sonata No. 11 in A major, K.331; his opera Die Entführung aus dem Serail, set in a highly exoticized harem, is another major one.
Beethoven wrote [at least a few](http://en.wikipedia.org/wiki/Turkish_music_(style)#Beethoven) pieces using this same kind of highly inauthentic style. By 1816, when his Sonata no. 28 was written, we're right on the cusp of the Romantic period, which saw much more liberal sampling from exotic foreign musics. However, I would be quite skeptical of any claim that Beethoven's use of a M3-m2 progression is drawn directly from Middle Eastern music, or even Andalusian music (which is more likely to have at least heard a workable version of), without some other compelling evidence for his interest in that style, evidence that I have been unable to find. It seems more likely to me that the Phrygian flavor was an incidental result of Beethoven's search for new dissonances.
Did the European Baroque and Classical composers know of other cultures'
Yes, kind of.
There's the exchange Spain and Portugal had with the musical traditions in the colonies of the New World (natives, plus the African slaves). Rhythmic patters of the new dances made its way back to the Old World: cumbé, zarambeque, possibly even the zarabanda. We can find subgeneres of Villancicos with names like negro, negrilla, guineo, or indio.
There was a lot of Moorish influence in Spanish music. The lute, quite a prominent instrument for a while, descends from the oud.
As /u/cheapwowgold4u mentions, there is Turkishness in the classical period (the marcia from Beethoven's 9th symphony is my favourite example of the presumable inspiration taken from Ottoman bands).
music theories?
Not really... As far as I know Western music was not influenced by other theoretical systems in those periods. The study of other musical traditions didn't quite start until late in the 19th century.
Am I making false connections or were some composers occasionally influenced by other cultures' music?
In the case of Beethoven's Op. 28, I think you totally are. There were influences in composers later in the 19th and early 20th century, but I don't see how that would be the case for Beethoven. He wasn't into boogie-woogie, either. He was doing his thing, and some times bits of his music remind us of something else.