IIRC Pythagorus was initially stationed in Egypt as part of the Ionian Carian forces under Polykrates (538-522 BCE) that helped Pharaoh Amasis rebuild Egypt after the country had been languishing for several hundred years following the attack of the Sea Peoples in around 1200 BCE. No doubt he acted more as an engineer or similar high-level officer rather than an ordinary soldier.
Regarding his mathematical theories, the Rhind Mathematical Papyrus and others similar are believed to have been penned during the Hyksos era, which shows how advanced mathematics was 1000 years before Pythagorus. Pythagorus may have had access to other Hyksos material.