The method of using slaves as armies and police force established already in the 9th century. The main reason for having slaves work in these professions was that most Arabs were not willing to work in what was considered despicable occupations.
The method came into practice this early because the state systems were more stable this way than having to depend on the will of the people to defend them. Slaves were easier to control, dependent and obedient.
The troops of Mahmoud of Ghazna for example were mainly made up of slaves.
At this time, this was completely legitimate. The slave trade was an inherent part of society back then.
The way into slavery was quite a usual thing. You could be captured or even be directly sold by slave traders over generations.
Often, high officers were “slaves”, though this term then only described their ancestry. It was part of the system to include slaves also in the bureaucracy. Some were even raised and educated at the court. Thus, some slaves turned into confidants and advisors of the ruler.
The Sinti used the first possibilities they had to escape to the West, since the East was still ruled by slavery and they might be known there. Hence, what remained was the unknown West.