They didn't.
Mexico remained neutral during WW1. The Germans tried to enlist their support by offering then Texas, New Mexico, and Arizona. The Mexican government turned down the offer and stayed out of the war.
They intercepted a message from Germany to Mexico to try to get Mexico to join the war
America never joined/allied with Germany in World War I and II. America was an ally and Germany was an axis. But America did join partially because of Germany. Germany announced that they would use their submarines on anyone and America felt threatened and decided they needed to take action. Germany also contacted Mexico and asked Mexico to help Germany defeat America.
The Zimmerman note proposed an alliance between Germany and Mexico during World War I. Germany sought to encourage Mexico to join the war against the United States, promising to support Mexico in regaining territories lost to the U.S., such as Texas, New Mexico, and Arizona. The note was intercepted and decoded by British intelligence, contributing to U.S. public support for entering the war against Germany.
1916 Great Britain intercepted a German message to Mexico stating that if Mexico join Germany's side and fight the United States of America, that Germany would after winning the war would give Mexico back taken land, but after the British had intercepted this, and showed it to the United states, the United states were then forced to join the war.
The Zimmerman telegram was published in the United States on March 1, 1917. It was a coded telegram asking Mexico to join Germany's side on World War I and Germany promised that if they join them that they would get their lost and back from the United States. Here is what they lost to the United States: New Mexico, Arizona and Texas. The zimmerman Telegram was the last straw for the United State and on April 6, 1917 the United States declared war on Germany.
Arthur Zimmerman
Turkey joined Germany in World War 1
The Zimmerman telegram was published in the United States on March 1, 1917. It was a coded telegram asking Mexico to join Germany's side on World War I and Germany promised that if they join them that they would get their lost and back from the United States. Here is what they lost to the United States: New Mexico, Arizona and Texas. The zimmerman Telegram was the last straw for the United State and on April 6, 1917 the United States declared war on Germany.
A time in 1914
The note, known as the Zimmermann Telegram, proposed that if Mexico joined the Central Powers in World War I, Germany would support Mexico in reclaiming territories lost to the United States, specifically Texas, New Mexico, and Arizona. Additionally, Germany promised financial assistance and military support to Mexico. This communication was intercepted by British intelligence and ultimately contributed to the U.S. decision to enter the war against Germany.
March 22, 1942.
Germany had mesaged Mexico saying "If you join our side in the war... WHEN we win, we will give you all of Texas, and New Mexico"... When America heard this news, they were not hesitant to pick sides... Therefore, they fought for the allied powers.. =)