That's correct.Pharaohs were ruling Egypt in ancient times.
Note that if you wanted to produce a translation that reflected the emphasis of the original more accurately, you could turn the construction into the passive and say "In ancient times, Egypt was ruled by pharaohs". This translation is more suitable in a situation where Egypt is the theme of the sentence, as it clearly is in the Latin by Aegyptum coming first.
Your translation is fine at this stage because you're still at a level where you have to consolidate your understanding of what is the subject and what is the object etc., but I'm saying this so you can perhaps keep it in a back-corner of your brain for the future: word order conveys nuances that are sometimes best rendered by an at-first-sight-less-literal translation.