Bajor was formally annexed by Cardassia, which meant that the Bajoran Government at the time signed a formal agreement that turned the world over to the Cardassians. It was probably because they were threatened or bribed into it but it was all 100% legal under whatever Galactic Laws the Powers in Trek all agree to. The Feds couldn't interfere willy-nilly like that if it was all legal.
er, "legal agreements" signed under duress are pretty much by definition not legitimate.
putting a gun to some one's head to sign a treaty doesn't make it legal. Not to mention, the Cardassians would STILL have been in violation of whatever interstellar conventions on war crimes there are, as they routinely used slave labor and torture, which would have justified Federation intervention.