Presumably, it's to prevent the army from influencing the political process at the behest of the “Central People's Government” or from gaining control of the region's institutions by having members of the military elected to important positions. For example, one concern would be that soldiers could be ordered to support specific candidates and vote as a block.
This type of restrictions is not unusual in countries with a history of coups or other type of involvement of the military in politics like Turkey, Indonesia, or Brazil but it's not entirely uncontroversial either. Historically, similar regulations also existed in some Western European countries like France (until 1945 in that particular case), where, to this day, active soldiers cannot be members of a political party.
It would also seem particularly important given Hong Kong's peculiar situation within the “one country, two systems” framework. Hong Kong institutions were designed to provide some guarantees against interference from a central government operating under completely different principles than the local institutions. In this context, the role of the army, which is controlled by the central government, is particularly sensitive.
Similarly, the central government cannot simply “send” people to Hong Kong, the local institutions control who can or cannot become a resident and the issue has sometimes been contentious. PRC soldiers on the other hand are selected and trained by the central government.