Salting is used because most bacteria, fungi and other potentially pathogenic organisms cannot survive in a highly salty environment, due to the hypertonic nature of salt. Any living cell in such an environment will become dehydrated through osmosis and die or become temporarily inactivated.
It was discovered in the 19th century that salt mixed with nitrites (saltpeter) would color meats red, rather than grey, and consumers at that time then strongly preferred the red-colored meat.
Jewish and Muslimdietary laws require the removal of blood from freshly slaughtered meat. Salt and brine are used for the purpose in both traditions, but salting is more common in KosherShechita (where it is all but required) than in HalalDhabiha (as in most cases, draining alone will suffice).