It's possible, we have NATO/Warsaw Pact as recent guides, as well as UN Forces (though they're not as analogous IMO) Looking back in time, you might also find Revolutionary-Civil War America (especially the CSA) and the Austro-Hungarian Imperial&Royal Army as an interesting microcosm of the idea. Interestingly the biggest problems these forces have tend to be political. For example:
What language do we speak?
Armies fight best when everyone speaks the same language at least well enough to receive orders. Realistically on a modern battlefield you need to speak the "Army" language fairly fluently, to be able to rapidly get across complex ideas. That argument alone could last years and lead to terrible politically-expedient "solutions." For example, the A&H military in 1914 had units that spoke their native language, led by officers who spoke it fluently as a second language. But the moment these units started taking losses the replacement officers often didn't speak their regiment's language! Or regiments would have maybe one person in several hundred actually capable of speaking German/Hungarian well enough to receive orders from higher up!)
What equipment do we use?
The member-nations will have competing industrial concerns. Producing for the combined military might of the alliance is a HUGE financial boon to whatever nation can secure a contract. Take the eternal EU-arguments over having a EU Military. Do they use German tanks? French ones? British? (pre-brexit) Maybe a whole new design incorporating tech from each country? And it's not just tanks, rifles, radios, rations, you name it! It's exceedingly unlikely they'll just "take whatever is best" because "best" is somewhat subjective. But more to the point, they don't want to give any one nation too big a sway over the military. If Bregoland provides all the tanks, aircraft, trucks, radios, and rifles for the alliance, Bregoland can nix potential military activity by going "hey we're not going to produce these goods anymore." So Bregoland, Utopistan, and everyone else each produce one core piece of military hardware. Except Bregoland really DID make the best of all the things I listed before, so you go to war with second-rate Utopistan tanks/whatever. Or maybe Bregoland gets overrun in the first six weeks of fighting, and suddenly you have 0 tank manufacturing capability because literally all of it was in Bregoland because politics. You foresaw that possibility, but for economic reasons you couldn't ding Bregoland's already-smaller-than-Utopistan's GDP by allowing production elsewhere.
Where we Fighing?
You say they have "mostly" common enemies. That's a Big Deal. If Bregoland and Utopistan are sworn enemies of Country X but only Bregoland hates country Y... what happens? You might find Utopistan forces behaving like CSA states in the American Civil War, where some states forbade the use of their forces outside of their state/the CSA. You need firm laws and the political will to follow them. If each nation-state specializes what then? If Utopistan provides your alliance's aerial reconnaissance squadrons, what happens if they're deployed "for defensive use only?"
All these are difficulties that can and have been overcome. But they're just as likely to overly-complicate your military and can result in critical failures that cost the alliance a war.