This is a great question. There are several reason why city states during the Peloponnesian War might agree to laws outside their immediate control. In light of this let me name a few of them.
First, you need to realize in the Greek world there were many wars. It was not uncommon for city states to disappear altogether as these wars could be very destructive. For this reason, there were alliances and leagues. When city states were in these alliances (Delian league and the Peloponnesian league are two examples), they would at times have to do things that were outside of their control for the sake of the league. There was a quid pro quo arrangement.
Second, you also need to realize that the Greek world was very religious. So, at times, religion dictated that certain things needed to be done, which was outside of their control. When dealing with the religion of the ancient world, it is important not to have a modern mindset where religion is de-emphasized.