The first alphabet of letters (one letter for every single sound, in contrast to syllabary) was invented by the Phoenicians of Ugarit, now in Syria, next to Lattakia, about 1300 BC. It reduced, for the first time, the number of symbols to 28, which is exactly the number of Arab characters today, and only slightly more than the letters we have in Western alphabets. Semitic languages were the first to use the new system, quickly changing the form of most letters, and they were followed by Greek and Latin.
Neither the exact shape of the letters nor the direction of writing was predetermined. Some went left to right, others wrote from right to left. After some time, every people had developed its own way of writing, albeit using the same alphabet in principle. Most Semitic languages chose to write r-to-l.
As to the numbers, they have Indian origin, where they were written l-to-r. The Arabs adopted them, keeping the Indian tradition of l-to-r. What is called “Arabic numbers” in Western languages, is “Arqam hindiya” in Arabic!