You probably wouldn't get a common military unless the colonies contribute financially to their maintenance - ie you'd need some kind of common fiscal/economic policy. Britain encouraged the dominions to raise and train militias because they were becoming too expensive to run, involved extensive land commitments of the kind the UK had tried to avoid and because we wanted the money for the Royal Navy.
There isn't (yet) a common fiscal policy for the EU, but they take very large financial contributions from member countries. It would certainly be enough to fund a military if they chose to spend it that way rather than throwing money at the farm lobby. In my view, this is one of the places where the Brits went wrong in North America. Rather than direct taxation they could have simply agreed an amount required from each province, to be collected however the colonial assembly saw fit.
Perhaps it might have come about in a devolved model, that is the Dominions having control over their own affairs in exchange for a reduced amount of seats in London.
I still doubt that would have satisfied the desire for independence during the 20th cerntury though.
This would probably be the way it might develop. However, to be sustainable I think the imperial parliament would have to be separate from Britain's (or England's) parliament. I imagine it would be a lot smaller, however, considering its limited remit. Maybe something like how the US Senate was originally conceived - a handful of people agreeing through consensus the right collective foreign policy. The European Commission could be another template. I think an assembly of about 40 people, not directly elected, would probably be about right. And the right size to stave off independence too - people are trying to get on the UN security council, not leave it.