Not really true. Take NYC for example: the 'rattle watch,' was the first analogue to the police and they did have the responsibility of enforcing slave codes, but their primary responsibility was to look out for and put out fires. The slave patrol system mostly came about from the paranoia that southerners has after Nat Turner's Rebellion which was in 1831. By that point in time policing was a thing in major cities and sherrifs existed in smaller cities. So....while there is an overlap the idea that policing evolved from slave patrols is for the most part false