The Muslim army conquered Jerusalem, held by the Byzantine Romans, in November, 636. For four months the siege continued. Ultimately, the Orthodox Patriarch of Jerusalem, Sophronius, agreed to surrender Jerusalem to Caliph Umar in person. Caliph Umar, then at Medina, agreed to these terms and traveled to Jerusalem to sign the capitulation in the spring of 637
https://en.m.wikipedia.org/wiki/Islam_in_Palestine
This is how Arabs got Jerusalem at the first place