Ptolemaic army
The Ptolemaic army was the army of the Ptolemaic Macedonian kings that ruled Egypt from 305 to 30 BC. Like most of the other armies of the Diadochi, it was very much Macedonian in style, with the use of the long pike (sarissa) in a deep phalanx formation. Despite the strength of the Ptolemaic army, evinced in 217 BC with the victory over the Seleucids at the Battle of Raphia, the Ptolemaic Kingdom itself fell into decline and by the time of Julius Caesar, it was but a mere client-kingdom of the Roman Republic. The army by the time of Caesar’s campaigns in the eastern Mediterranean was a mere shadow of its former self: generally, a highly disorganized assemblage of mercenaries and other foreign troops. The army of Ptolemy I

Ptolemy I was a general in the army of Alexander the Great and after Alexander’s death had taken over the province of Egypt as a satrap (local governor). Along with the other successors to Alexander he did not hold the title of king until 305, but was still an important player in the affairs of the Macedonian Empire in the east. In 312 BC at Gaza, Ptolemy, who was assisting the fugitive satrap of Babylonia, Seleucus I, came up against the forces of Antigonus I who was seen as a major threat to the stability of the empire due to his strength and power. Ptolemy had a force of 18,000 infantry and 4,000 cavalry, these being a mixture of Macedonians, mercenaries, and native Egyptians. His forces were larger than those of Antigonus and his son, Demetrius Poliorketes. In the battle for Gaza, Antigonus’ cavalry, commanded by Demetrius, were initially successful but forced to retreat after Ptolemy out-flanked them. The battle was a victory for Ptolemy who soon secured Syria for himself and placed Seleucus in Babylonia to govern the eastern provinces of the empire. By 305 Ptolemy had taken the title of king, along with the other most powerful generals, including Cassander, Seleucus, and Antigonus. In 301 BC, the threat of Antigonus was finally ended with his death at the Battle of Ipsus. But despite this, the rivalry between the Ptolemies and the Seleucids for Syria would cause numerous wars in the future. The army under Ptolemy I was most likely composed of small Macedonian and mercenary garrisons left in Egypt by Alexander. Socio-economic status of Ptolemaic soldiers 
Ptolemy I granted his soldiers land to order to strengthen their loyalty. The granting of land also allowed for soldiers to easily mobilize when needed in times of war. This concluded to the distribution of soldiers throughout the countryside alongside the founding of a single Greek polis in Egypt, Ptolemais. The Ptolemies also created a cleruchy system in order to collect revenue from these plots of land. The addition of the cleruchy system allowed for "the diversification of the location of military settlements, a decrease and leveling of the size of soldiers’ plots and expansion of the system to a larger pool of locally recruited individuals." The manpower problem
In the Ptolemaic era a small population of Greeks provided the main cadre of the army. These men provided manpower for the elite guards units and the phalanx that lay at its core. However, the distance of Egypt from Greece caused considerable difficulties as the population of Greeks in Egypt was and remained small. To remedy this problem, the Ptolemies set up military colonies and encouraged settlers to settle in them. In return for these plots of land, the kleruchoi, as they were known, would be obligated to provide military service. Mercenaries were also employed by the Ptolemies, who could afford it due to their wealth. For example, Ptolemy IV paid 1,000 drachmas a day for one distinguished Aetolian officer to serve in his armies. This system gave the Ptolemies more manpower, but they still suffered severe shortages. Despite this lack of manpower, they would not allow native Egyptians to fight in the army proper. The natives would only serve in the navy or as auxiliaries. This changed by the time of Raphia in 217 when the situation became especially dire for the Ptolemies. Their army was far too small to counter the far superior Seleucid force led by the formidable Antiochus III. To counter the larger Seleucid force, the general Sosibius assembled a large army which he trained for the fight to come, and in which he also enrolled 30,000 native Egyptians to serve in the phalanx. These 30,000 picked Egyptians, known as the Machimoi Epilektoi, fought well in the battle, but caused problems later on. The increased status of these Egyptian troops enabled and encouraged them to revolt, which led to a further crippling of the kingdom in the years following Raphia. Later years and Roman influence
Reforms in the late Seleucid and Ptolemaic armies re-organised them and tried to add some Roman aspects to formations. Stelae from Hermopolis show a Ptolemaic unit having a standard-bearer and other staff attached. This unit was like a Roman Maniple, being composed of two smaller units led by a Hekatontarch (i.e. a Centurion). The title of Hekatontarch appeared around the 250s BC in the Septuagint (Greek translation of the Hebrew Bible) which uses hekatontarchos (ἑκατοντάρχους acc. pl.) to refer to 'captains of hundreds' (eg 2Chr25:5). As well as this, Asclepiodotus describes in his 'Tactica' a new institution, the Syntagma, which had a standard-bearer, other staff and was composed of two smaller units led by Hekatontarchs. The Phalangarkhia, also described by Asclepiodotus, was about the size of a Roman Legion in strength. The potential Roman influence would have been great. In Ptolemaic Egypt, Roman adventurers and veterans are found commonly serving under the Ptolemies. Romans are found in Ptolemaic service as early as 252/1 BC. The Ptolemaic army was odd in that, out of all the Hellenistic armies, it was the only army where you could find Romans in Greek service. As Sekunda suggests 'such individuals would have spread knowledge of Roman military systems within the Ptolemaic military and political establishment'

However, the continuous struggles for power between Ptolemaic kings and the decline of the kingdom itself soon turned the army into a mere shadow of its former self: generally, a highly disorganized assemblage of mercenaries and other foreign troops. In 61 BCE, Aulus Gabinius, the Roman proconsul of Roman Syria, restored the king to the throne after a short campaign. Then he left a part of his army, called after him the Gabiniani, in Egypt for the king's protection. These Roman troops also included Gallic and German horsemen. They married Egyptian women and had already fathered children with them before the arrival of Caesar in Egypt (48 BC). Over time, they lost their connection with Rome and became a loyal protecting power of Ptolemy XII, who used them in fights against rebellious subjects. When Julius Caesar arrived in Egypt and supported Cleopatra in the struggle between her and her brother. Pothinus organized military opposition against Caesar. In the Alexandrinian war that followed, the Gabiniani played an important role: they were the core divisions of Achillas' army that comprised 20,000 infantrymen and 2000 cavalrymen. After the successful conclusion of the Alexandrinian war, Caesar replaced the Gabiniani with three reliable legions, the XXVII, XXVIII and XXIX. These served as the Roman occupying army of Egypt and were tasked with protecting Cleopatra but also to ensure the queen's loyalty to Rome. References 

Military history of the Ptolemaic Kingdom
Hellenistic armies