I'm currently reading a book called Empire by Default by Ivan Musicant, which is primarily about the Spanish-American war. The book features a long section about the Cuban Revolution and the battles it was made up of. According to page 64 of the book, in 1896, as the rebels pushed further into Spanish territory, "In Alquízar, all arms and supplies were given up without a fight. At Ceiba de agua, the rebels were welcomed by the town band. (...) Town after town fell, and at every one the rebels increased their ranks."
The book mentions elsewhere that many of the soldiers within the rebel army were previously slaves, and on page 57, in a section about General Gómez's economic warfare strategy, says the following:
"Gómez ordered his economic warfare strategy into practice; Cuba would simply stop functioning, and if need be, would starve. Prohibited by rebel decree were the transport of leather, timber, wood, tobacco, coffee, wax, honey, and cattle into any town occupied by a Spanish garrison, no matter its size. 'The sugar plantations will stop their labors,' read his edict. 'Sugar cannot be allowed, because to work means peace, and in Cuba we must not permit working.' For the rebels, a positive side effect brought thousands of now unemployed workers into their ranks."
I wasn't surprised by the idea that slaves would join a revolution that freed them - I remember the same happened in the Civil War in the United States, but I was surprised to learn that, although the Cuban revolutionary army instituted policies that negatively affected the civilian population, they were actually more likely to join the war effort. Is it the historical norm for military-age men who are politically and economically disenfranchised to join the military of whichever government they are occupied by, even if they have only recently come under its occupation? If so, what measures are typically taken by militaries in order to ensure loyalty? Are there any examples of military failures caused by disloyal soldiers recruited this way?
While it is no proof that it was indeed normal, I know further examples which strengthen the idea that it was, indeed, very likely.
In William Dalrymple's "The Anarchy" (a collection of works, rather than it's own historical source) he describes how the British East India Company got a foothold in India during the 17/18th century. Basically, as soon as the British start even the smallest trading missions they employed 'sepoys': Bengali locals trained in the 'European' ways of war and equipped with 'modern' equipment such as rifles. These sepoys were still headed by a British officer, but were certainly locals.
Throughout the book Dalrymple consistently distinguishes, within the various armies in question, how many were men were European and how many were sepoys. To answer the question on why these locals would ever do this, the simplest answer would be that it paid well. If you survived it, off course. While this reason is not given explicitly in the book itself, the contrary occurs often: Emperors and Nawab's (local leaders) who had no money faced mutiny, and poorly paid soldiers were prone to looting and generally ransacking villages and cities. (This was a problem to such an extend that the fact that soldiers started looting before the battle was ultimately over, is attributes to a number of unexpected losses. If your soldiers stop fighting to early, you lose.)
In my personal opinion, this mostly displays how little many of the locals cared (or, got to care when you consider poverty or general lack of economic prosperity) about who was actually leading their army, province, country, etc, as long as they got paid. Again, this is not explicitly mentioned in the book but the opposite is: Only some parts of the armies in question are hailed for being loyal to their cause, commander and/or country. Implying that most regular soldiers were not.
So I think that many people did join invading and/or occupying forces. If only for a good pay check.