... "legal agreements" signed under duress are pretty much by definition not legitimate.
Add to that, any "legal agreement" entered into by the Bajorian government likely did include slavery, interment camps, and stripping the planet of resources..
Plus sovereign entities (assuming Bajor was still consideed one) can exit agreements as they see fit. Usually with simple notification.
The Federation likely didn't just step in and end the Cardassian occupation because they themselves were engage in a long term conflict with the Cardassians. The Federation lacked the ability to make the Cardassian do anything at the time.
Very doubtful Starfleet had access to Bajor.
That's not the reason Picard gave in "Ensign Ro." He indicated that it was just a matter of the principle of non-intervention.
If they were already INVOLVED in a conflict with the Cardassians, you'd think it would make them MORE inclined to intervene in Bajor, not less.
(look at how the Union army freed Southern Blacks during the American Civil War, or allied armies liberated concentration camps during WWII for example.)