This word was often used by Americans of Italian descent (at least, in my neighborhood in Philadelphia), as a term of abuse, even when speaking English. Devoto's "Avviamento alla etimologia italiana" cites its origin as the Arabic word "mamluuk", which is used in several contexts in Islamic history, the most notable being the Mamluke Kingdom of Egypt. Does anyone know if mammalucco entered Italian during the occupation of Italy and Sicily by the Arabs, or if it entered Italian at some later time?
Zingarelli dictionary of Italian (paper edition or behind a paywall) gives, for every word, the century or year of its first use. For mammalucco, it gives the 13th century.
Here is the page of the very authoritative Grande dizionario della lingua italiana where the article mammalucco appears:
(original URL: http://www.gdli.it/JPG/GDLI09/00000599.jpg)
What is especially relevant are the examples from literature: while not guaranteed to be the very first occurrences, they give an idea of when the word was already in use. So you can see examples from Andrea da Barberino (c. 1370–1431), Luigi Pulci (1432–1484), Pietro Aretino (1492–1556) and several more.
So, all in all, the word seems the have entered in use quite later than the Arab conquest of Southern Italy (which took place at a time when Italian, in any modern sense, did not exist; and the word, even in Arabic, appears to date back to a later time, the Ottoman rule of Egypt, as the OP mentions), but still has quite a long history in Italian.