There are different types of slamfire, the most scary one is while loading and cocking the weapon, this could be due to a faulty trigger group which allows the hammer to be released along with the bolt carrier folowing right behind as though the trigger was pulled, or because of a free floating firing pin which carries forward with inertia, with heavy milspec firing pins and lame civilian ammunition the primers could be detonated just by this inertia.
Another type of slamfire known as doubling can be caused in the same way, this is when two rounds are fired instead of one. Sometimes this can be even worse and your whole magazine can be unloaded.
Several civilian shooters have been killed when a fully automatic weapon has been loaded with commercial ammunition and has unintentionlly fired when loading.
Inertia problems can be fixed by using real military ammunition instead of civilian or by switching to a lighter firing pin. Faulty trigger groups are a serious but rare problem and should be fixed by an armourer ASAP