This is a much longer answer on the history of the Legion, but does address your question in the sections on WWI and WWII. To reiterate those parts:
Through this period, the Legion's makeup included a large number of Germans, 34 percent hailing showing Germanic origin, mostly from southern German states who resented the Prussian hegemony. Alsace-Lorraine also was a very popular - 26 percent - origin immediately after the annexation of the region by Germany, as the Legion offered not only a way to avoid conscription into the German Army for the Francophonic residents, but also would result in French citizenship at the end of their service. The A generation removed from the Franco-Prussian War though, the German contingent dropped significantly through the first decade of the 20th century though about 18 percent, and Alsace-Lorraine dropped to almost nothing as well. By the time World War I broke out in fact, nearly half the Legion was actually Frenchmen ("Belgians" or "Swiss") - an unfortunate turn as many noted that the Francophonic legionaries were often the least disciplined.
Anyways though, with the outbreak of war, the Legion again was needed in Metropolitan France. Some Germanic soldiers did desert, but many were simply shifted to the régiments de marche maintained in Morocco while those of more trustworthy nationalities were used for the excursion to France proper. Many German veterans though who had already gained the right to citizenship after five years of service, volunteered to go to France and were granted permission. The outbreak of war, in fact, saw such a huge influx of volunteers for the Legion that two new régiments de marche were formed almost immediately. The Legion was immense at this point, and nearly 43,000 would service in its ranks in Europe during WWI, with a little over 5,000 dying. They would also see action at Gallipoli and would participate in the Intervention force sent to Russia during the Civil War there.
Although well bloodied from the fighting, the end of the war would again be a boon to their existence, in a sense. More than ever, France had an aversion to spilling French blood, but she nevertheless had vast overseas holdings that needed administering. Gen. Jean Mordacq, an advisor to Clemenceau and a former officer in the Legion, pushed hard for expansion, and saw to it that cavalry regiments were created, although the artillery regiments he desired never materialized. With more than a bit of irony, heavy recruitment was targeted at the POWs of the defeated Central Powers, and made up a very large proportion of the post-war legion - the 2nd Regiment seems to have been composed of 52 percent Germans! This was against general policy which was to avoid to high a concentration of one nationality, but given the circumstances it was looked past. Russians soon became a large contingent as well, and perhaps the most notable change in composition is that Frenchmen (again, "Belgian" or "Swiss") had fallen to single digits after making up nearly half of the pre-war legion.
Follow up question, what role did legionnaires have in WW2?