Semitic Mem is most likely derived from a "Proto-Sinaitic" (Bronze Age) adoption of the "water" ideogram in Egyptian writing.
The Egyptian sign had the acrophonic value /n/, from the Egyptian word for "water", nt; the adoption as the Semitic letter for /m/ was presumably also on acrophonic grounds, from the Semitic word for "water", *mā(y)-.
The Oxford English Dictionary (first edition) says that ⟨m⟩ is sometimes a vowel, such as in words like spasm and in the suffix -ism.
The letter ⟨m⟩ represents the voiced bilabial nasal /m/ in the orthography of Latin as well as in those of many modern languages.
In the International Phonetic Alphabet, ⟨m⟩ represents the voiced bilabial nasal /m/.