They are case endings. They tell us whether the word is nominative, accusative, or genitive, like endings in Russian. We don't write short vowels in Arabic except as optional diacritics, and in the case of that "-n" sound found in the most common case endings, we also made diacritics for it, so endings with short vowels are not written explicitly in most Arabic texts. And when reading out loud, Arabs often ignore them nowadays, or when they try to use them, end up misusing them.
The former if you're speaking with a Levantine (Syrian, Lebanese, etc.) accent, the latter if you're speaking with a Gulf (Saudi, Kuwaiti, etc.) accent. Standard Arabic does not have an accent of its own, everybody pronounces the vowels and consonants like they do in their own native dialect.