Some languages have a common ancestor language. They evolved from that ancestor language and took separate paths.
People pronounce words differerently now then they used to in the past. But they pronounce them (roughly) the same as other people around them. When people start to pronounce a consonant or vowel differently, they pronounce the same consonant or vowel differently the same way in the same situation. If a <t> becomes an <s> in a certain situation in one word, people are likely to pronounce the <t> like an <s> in other words too if the same situation holds true.
This happens for several reasons, the most obvious being the introduction of new speakers to the language who simply aren't used to pronouncing a certain consonant and use the most similar consonant they do know to replace it everywhere it appears.
For example, native speakers of a European language learning Hebrew find it so difficult to pronounce Ayin and Het that they simply pronounce them like Alef and Khaf (and even those two are difficult for English speakers, who often forget to pronounce the Alef and pronounce Khaf like Kaf and then Het like Heh instead).
Ayin is a voiced pharyngeal fricative and Heth is the unvoiced counterpart of Ayin. Pharyngeal consonants don't exist in most non-Semitic languages. They also died out in those Semitic languages spoken in areas were Sumerian was dominant for hundreds of years, in Iraq. (They returned to Iraq with Aramaic and later with Arabic in full force.)
Outside the influence of outsiders, consonants tend to collapse; that is people start pronouncing two similar consonants the same.
If that happens before the introduction of a script, the two consonants will appear to be the same in all written text and be understood as such.
If it happens after the introduction of writing, it will create a headache for those learning how to write as they struggle to figure out why there are two distinct symbols for the same consonant. (This problem must be rather worse in syllable-based scripts.)
If it happens during the introduction of the writing system, knowledge of the distinct pronunciations might survive among readers but not be marked in the script. (Or alternatively, they do mark the distinction somehow.)
It happened, for example, with the pronunciation of the voiceless pharyngeal fricative (Heth) which apparently had two distinct pronunciations (and was likely understood as two distinct consonants) in ancient Egyptian because the original Sinaitic script adopted two hieroglyphs that represented two distinct words to represent these two distinct pronunciations.
Apparently this is a "hasir", a courtyard, so says Wikipedia.
I don't know where the word comes from I find the word חצר in Hebrew meaning "courtyard" and the word حصر (spelt the same) in Arabic meaning "enclose". (And according to the Comprehensive Aramaic Lexicon, the same root means "besiege", "grass" but also "little finger" in Aramaic, so these things can be driven too far.)
You can play with the words on my script transliterator.
But likely representing a word that originally started with a similar-but-different consonant is this hieroglyph "hait" which represents a "thread". In Arabic "thread" is خيط which indeed still starts with a similar-but-different consonant but which uses the same symbol as the unvoiced pharyngeal fricative of "hasir" with a dot added.
Behold, the hieroglyph "hait". (Note that the "t" in "hait" is an emphatic <t>.)
So why did the Arabs add a dot rather than use a different symbol for their different consonant?
The answer is remarkable simple. There was no other symbol. The two consonants collapsed in the languages the original script was used for and became Heth, the first letter of the Hebrew word חית meaning "fence" which sounds eerily related to both "courtyard" and "thread" and maybe that was one of the reasons it was used to replace both the original symbols. (Note that חית ends with a normal <t> but not, like "hait" an emphatic <t>. "Heth" and "hait" do not share the same type of "t".)
When the Arabs took whichever version of the Aramaic script they used, they only found one symbol for the unvoiced pharyngeal fricative and the closely related consonant they still had in their (unwritten) language and so they used the symbol for Heth ح and added a dot خ to make it stand for the other consonant as well.
Incidentally, in Hebrew the same word (but with the Heth instead of the Arab alternative consonant) חיט means "taylor".
Let me quickly list the two cognates (related words) we have found in Arabic and Hebrew so far, just taken from the names of the letters of the alphabet.
||ح ص ر
||خ ي ط
That was an easy one. Two consonants became one and then two again. Problem solved by treating them as one in writing and all cognates are easily found.
There is another famous case related to collapsing consonants in Hebrew. The Hasir-Hasar-Heth debacle happened before writing was invented but another such problem happened a little later.
It's the Ayin-Ghayin dilemma.
In the Arabic there are two distinct consonants Ayin and Ghayin which are, like Heth and its similar-but-different compagnon, represented by the same symbol (and added dot): ع is Ayin and غ is Ghayin.
But Ayin and Ghayin do not sound similar... It's a bit of a riddle.
What can be seen is that Ghayin doesn't exist in the Hebrew script. Ayin is ע and that's it.
However, in an early Greek translation of the Bible from 200 BCE names and place names with Ayin was transliterated into Greek using two different Greek letters. The symbol for "g" was used for ע in some places and the symbol for "h" (or two vowels in a row) in others. (Ayin in words other than names and place names was not transliterated but the words were translated into Greek words that didn't have Ayin or Ghayin.)
Name or Place Name
Bold and underlined are the Latin letters representing the Greek letters used to transliterate written Ayin.
2200 Years ago learned Rabbis still knew the difference betwen Ayin and Ghayin. The difference can still be seen in vowel patterns even in Modern Hebrew. Pharyngeal consonants (like Heth and Ayin) cannot be pronounced easily (or at all) when they follow or precede certain vowels, most prominently "i". But they collaborate well with others vowels, most prominently "a". Their presence therefor causes "i" vowels to vanish where they usually belong and be replaced with "a" or it causes an "a" to be added to a word before or after the pharyngeal consonant. I don't want to go into this. Anyone who ever conjugated Hebrew verbs knows the phenomenon rather well. The rest of you should just believe me.
A very good example for the Ayin-Ghayin debacle is the word רע which pronounced "re3a" (the "3" represents the Ayin) means "neighbour" or "friend" while pronounced "ra3" means "evil". The words are not related. The original Ayin in "re3a" caused an "a" vowel to be added to the word after the Ayin, while the original Ghayin in "ra3" did not. This difference in vowels remains until today.
And just like with Heth Arabic words with Ayin and Ghayin show Hebrew cognates with Ayin, consistently.
||ع ر ب
||ع ب د
||ع ي ن
||غ ر ب
||م غ ر ب
(**Hebrew ערבה does not have an equivalent Arabic word I know of. But I believe its meaning is related.)
However, the two pronunciations of Heth do not show up at all in Hebrew, which makes it convenient to assume that Hasir and Hait collapsed (became one) before writing was introduced to the Hebrew language while the difference between Ayin and Ghayin remained even over a thousand years after the introduction of a writing system that only had one symbol to represent both consonants.
Next in series: Interdentals ת (Taw), ש (Shin), ד (Daleth) and ז (Zayin)