Because they were a small city state which couldn't afford having a weak army in times where war or rather small scale conflicts were all around. Due to this, their focus on having a warrior society enabled them to stay alive as a city state and preserve their culture for a time.