In real life, the command structures of military bases jointly operated by the armed forces of multiple sovereign states, are worked out on the basis of treaties or other international agreements negotiated in advance by the relevant sovereign states. So, for instance, it is by international agreement that the commanding officer of the North American Aerospace Defense Command will always be a United States Armed Forces four-star general or admiral, and that the deputy commander will always be a Royal Canadian Air Force lieutenant general. Detachments of both the United States Air Force and the Royal Canadian Air Force that have been seconded to NORAD are bound to obey orders from NORAD no matter which country they're from, and NORAD's commanders are bound to take orders from their respective governments. Thus we had a United States Air Force fighter plane obeying an order from the Prime Minister of Canada to shoot down an object entering Canadian airspace a few months ago -- obviously normally the Prime Minister of Canada has no authority to issue an order to a USAF pilot, but that pilot had been seconded to NORAD and thus had to obey the Prime Minister's orders.
So it is, presumably, with Starbase Deep Space 9: The Federation and the Bajoran Republic have a diplomatic agreement on a common command framework to which officers of both the Federation Starfleet and Bajoran Militia have been seconded. The commanding officer of Starbase Deep Space 9 must obey orders from the Federation, but they also must obey orders from the First Minister of the Bajoran Republic (e.g., Sisko claiming Bajoran rather than Federation sovereignty over the Wormhole).