I understand that the heavy infantry were the land owners that could afford shields, spears and armor. They stayed loyal because the state protected their land and family through its laws, so fighting for the state was, as an extension, fighting for land and family.
But light infantry, being (typically) unable to afford panopoly, didn't necessarily own land, so how could a city state rely on them to be loyal?
In the Classical period, there were a couple of mechanisms to make sure they did their part.
One was the fact that military service was mandatory, and citizens could be prosecuted for failing to turn up or for deserting. However, these laws were practically never applied, and probably would not have been of much concern to light-armed citizens anyway, since they were not the primary target of the regulations.
A more compelling reason to fight was pay. The poor in Athens, for example, were usually the ones most eager for war, because it offered chances for seasonal employment with decent daily wages paid by the state.
If the light-armed were slaves rather than citizens, they might hope to earn their freedom by serving well; the Spartans routinely freed large numbers of helots for services rendered, and the Athenians freed all the slaves who contributed to the naval victory at Arginousai.
Adding to these individual incentives was the fact that the Greeks associated citizen rights with military service. You earned your status by contributing to your state's defence. In oligarchies, this would not have been much of a factor, because the poor had no political power (usually precisely because it was thought that they did not contribute to the war effort). In democracies, however, even if the poor could not afford to fight as heavy infantry, they would have felt significant moral pressure to do their part in return for the right to share in government and be protected by the law.
It's important to note that there was no strong class distinction between the light-armed and the hoplites. The great distinction was between the poor and the rich, but "the poor" was a very broad category, and many of them could afford to fight as heavy infantry. Many hoplites were not landowners but poorer men who had just about managed to scrounge together the money for a shield and spear, or even had these issued to them at some point by the state or some benefactor. Because of this, many poor citizens probably shared the ideals of the heavy infantry, aspired one day to be one of them, and hoped to prove themselves good citizens by fighting bravely in war.
Most important of all, though: who else would the light-armed be loyal to, apart from their own community? As poorer citizens, they worked the land of the wealthy, and so relied on the safety of that land just as much as the rich did; if not, they worked in the shops, on the construction sites, or in the docks of their city-state, relying on other citizens and resident foreigners for their livelihood. They had just as much of a stake in the survival of their state as the landowners.