While there were regional dialects and variations, the language spoken in Athens and Sparta was fundamentally the same. The differences were akin to the variations between American English and British English, not complete language barriers.
However, it is important to note that:
* Dialects existed. The way people spoke in Athens was slightly different from the way they spoke in Sparta. This difference was noticeable but not insurmountable.
* Literary Greek. In written form, the language of classical literature (which was often written in Attic Greek, the dialect of Athens) was more standardized than the spoken language of the day.
So, while there were variations, the people of Athens and Sparta could generally understand each other.