Arabic was one of the modification of the Aramaic script, which in its turn inherited much from the Phoenician alphabet. This means that both European alphabets (like Roman and Greek) and main Asiatic scripts (including Arabic and Hebrew) were descendants of the same Phoenician alphabet from Palestine. Nowadays, however, no similar symbols remained in European and Arabic writing, too much time has gone.
By the time Arabic invaders conquered Persia, its population wrote either in the Greek alphabet, or in different varieties of the Aramaic script (Pahlavik, Parsik, Parthian, Avestan, Khwaresmian). In one of them, Avestan, the famous epic was written. For Persians, therefore, it was easy to get used to a new alphabet very much alike Aramaic. Since the 8th century Arabic is introduced everywhere, and when Baghdad becomes the capital of the Khalifate, it became official in all countries which were taking up Islam. The religion played a vital role in the spreading of Arabic to most countries, because all Islamic sacred books were written in it, and nations had to learn it in order to read them.
In the 12th century the Arabic alphabet was used together with the Arabic language in Iran (Persia), Western Islamic India, Central Asia, in Spain, North Africa, in the Caucasus and even in Malaysia and Indonesia. Soon not only Arabic texts and documents were written in the script, but also documents in native languages. Persian and other Iranian tongues had only to add several new symbols to their alphabet, and make some changes, and Indic languages spoken by Muslims accepted the modified Persian script.
So, to put it shortly, today's Persian alphabet is Arabic with several additional signs and new features, and Urdu is the same Persian script with again three extra symbols. Both Urdu and Persian are written from the right to the left.
Languages which use the scripts:
Persian is used by Iranian languages (Persian,
Dari, Pashto, Azerbaijani, Gillani, Ormuri etc.), Nuristani
Urdu is used by the Urdu language, and by some other Indic and Dardic languages (Brahui, Kashmiri).