Imagine 2 kingdoms are constantly at war and both sides would hire mercenaries for this cause, usually they will hires mercenary soldiers from the adjacent villages but this time one of the King's long time advisor suggested hiring mercenaries whom they have fought many years ago to have a better chance to score a decisive victory in the coming battle. I am wondering if there is any advantage to hire an ex-enemy to fight in the war? We assume these mercenaries are professional and they are not double agent/trojan.
This happened quite frequently in the past, and has indeed quite some advantages.
As you state, they are often professional. Their loyalty is with the money, and they will follow whomever pays (the most), or whomever they have a contract with.
You need to consider that a hired solder has nothing but their integrity. If a solder is known to back stab and turn coat, no lord would think about hiring them as they would be useless in combat. Meaning they would be out of a job.
For soldiers as much as any profession, experience counts. It doesn't matter where this experience was collected, it is quite often a better idea to hire a seasoned veteran than a freshly trained recruit.
Apart from getting paid, a solder would prefer to stay alive to spend their money. If they have intelligence on the enemy, because they used to fight for them, there is a fair chance they would share it to up their chances of victory. Or more importantly, surviving and getting paid. The same applies for knowledge about the terrain, or ideas about battle tactics.
If you hire all the mercenaries your enemy would normally use, the enemy can't hire them. This means they have a smaller pool of soldiers to choose from, and could end up with a smaller army than you.
Please note: Lords would be aware this happens, and your mercenaries might end up with the enemy in the future. Therefore crucial tactical intelligence and details would mostly be kept secret from them, and their instructions would often be "Just show up here and fight". This is why I didn't mention this specifically as a tactical advantage.
In addition to what Plutian the employment of mercenaries may lead to less bloody battles as less people are willing to die for coin than for honor/glory/etc. Furthermore I do recall that I read somewhere that the Italian peninsula saw less pillaging, raping and looting than it was "the norm". The argument for that was that the condottieri did not want to kill/offend somebody that may be their employer in a week or so.
Normally, it wouldn't be a problem. However, there are few concerns.
1) Loyalty. Do those mercenaries have reputation? If they had fought for multiple employers and honored their contracts, hiring them should be no problem.
2) Past offenses. Did those mercenaries commit atrocities against the kingdom? Do they have an ill reputation similar to GoT/ASoIaF Brave Companions among the people? If it is so, they still can be helpful against the enemy, but hiring them may create a friction within the kingdom itself. Many nobles and regular soldiers would rather settle scores with this company than fight alongside them.
You won't feel bad about sending them off to be slaughtered as a sacrificial unit; and you won't make the mistake of trusting them too much.
Also, if the enemy really wanted/needed them (because of a shortage of cavalry/pikemen/bowmen/whetever the mercenary unit is), then hiring them deprives the enemy of a crucial resource.
And because you can then use them to bargain down the rates of local mercenaries when they realise they're not actually needed and might be unemployed.