I was looking at a video ("The History of the World: Every Year by Ollie Bye https://www.youtube.com/watch?v=-6Wu0Q7x5D0), and at 12:35 (around the beginning of Islam) the first caliphate spread at a phenomenally fast rate. How come the Byzantine and Persian Empire could not defend themselves? Was it the product of military genius? Or, were the Byzantines and Persians weak at the moment?
The Last Great War of Antiquity 602-628 is your answer here, as well as the Plague of Justinian in 541. It created a huge power vacuum. The Plague is believed to be the first instance of bubonic plague in the Mediterranean although debate still rages over how much Procopius used Thucydides as a model. It essentially killed a third of the Byzantine population, IMMEDIATELY after they had just conquered Italy slowly and terribly and precipitated the Lombard invasion that drained the empire's manpower for thirty years.
Arguably, the empire recovered by the reign of Maurice but his overthrow by Phokas (602-610) broke an agreement with the Persian Shah Khosroes II who had been restored to his own throne by Maurice's armies. Phokas now faced a Persian pretext for invasion which fell on the fortress of Dara for ten years and once the Persians were through the frontier they sacked city after city which contained more feeble defences. The Persian general Shavarazh (the spelling of this name changes) advanced to Chalcedon in the Bosphoros opposite Constantinople and occupied it for five years in the 510s. Behind him Persian forced captured Jerusalem, Egypt, Anatolia and Antioch. The empire was shattered and only Constantinople and Armenia, kept in contact by the Black Sea, managed to organise a defence which was achieved by Shavarazh defecting from Khosroes as the Shah believed him to be planning a coup and trying to kill him. Heraclius (610-641) paid off the gokturks to invade Persia while he led a retrained and newly recruited army which he had tested in several failed campaigns from 618-625.
The conclusion of the war was swift because Persia fell apart. Byzantium never reoccupied and ejected the Persian garrisons across the empire. They won in two years a war of thirty by invading Persia from Armenia and sacking Ctesiphon, the Persian capital. Khosroes was murdered by his own nobles and so ended the direct line of the dynasty, what came after was a series of deposed shahs who simply recalled the Persian forces across the Byzantine empire, an entire generation of which had barely known Byzantine rule and which they resented in many cases. The Persian empire is often difficult to know as despite being a highly literate society, their libraries and books do not survive. It's important to understand this silence; it seems to be from library destruction by Arabs and generally the dampness of Mesopotamia causing manuscript disintegration.
This was the situation when in 634 the Muslim Arabs invaded Syria. Persia was more of a confederacy of Iranian aristocrats ruling a Parthian confederacy. I've borrowed that phrase from 'Decline and Fall of the Sasanian Empire: The Sasanian‑Parthian Confederacy and the Arab Conquest' by Pourshariarti. It's an interesting read and it pieces together a lot of fragments.
I haven't even touched on the Christian divisions of the Miaphysite and Chalcedon churches which alienated Egypt, Syria and Armenia but someone else can jump on that. Essentially these regions when the Arabs arrived were given the ability to worship with their own creeds under islamic rule rather than suffer Constantinople's interference.
Islam united the Arab tribes and gave them battle fervour and a belief that they carried a holy message. Heraclius' armies met them at the Battle of Yarmouk River in 636 but the great warrior emperor was by then an old man and critically sick with dropsy. He did not take the field in person and remained at Antioch deputising his son-in-law. The army was huge but was caught in a sandstorm and massacred. The armies which survived were pulled back to Asia Minor, divided into four/five as the start of the theme system and told to live off the land and be paid in kind as the gold deposits without Egypt and Syria were massively depleted. The Arabs advanced across the eastern provinces without facing another massive army and Byzantium began to recognise that their territorial limits could not exceed their ecclesiastical-ethnic boundaries as they lacked the manpower to enforce or restore their authority.
The armies were now smaller and highly demotivated, Constantinople survived thanks to its defences, Greek Fire and Balkan alliances. But an incredibly poignant physical marker survives. When the Avars-Persians besieged Constantinople in 626 they cut the Valens aqueduct, the largest in the city. The population of the capital was so small however that in the intervening period it was not rebuilt until 758. There were not enough people in the capital to actually need that level of water anymore.