It's not even slaves had to fight, but that only (or primarily) slaves can fight. The point of slave soldiers is to separate the people with arms and training from the population as a whole to prevent rebellion or revolution. Ideally the army can't revolt because they are despised by the people, and the people can't revolt because they have no arms and training and the despised soldiers will eagerly crush them.
Slave soldiers are just one method of creating an armed caste separate from and despised by and despising the entirely demilitarized people. Every autocratic empire in history eventually reaches this same conclusion. And it's the empire's founding core population that its elite and rulers want to demilitarize first, not subject peoples because they are the ones best able to overthrow the elite. The Roman Empire demilitarized italians and made an army of provincials and foreign barbarians. The Islamic caliphate demilitarized arabs and made an army of turkish, caucasian, and black slaves. This serves the interests of the elite until it doesn't. The same Italy that formed army after army even as Hannibal crushed each and bled to eventual total victory was completely defenseless as bands of a few hundred or thousand unpaid barbarian mercenaries roamed around.
This phenomenon is not a development over history, but rather a cycle over each state's rise and fall as elites turn from leading to exploitation.