People were paid to protect someone's stuff, those people were called guards, but they weren't enforcing law. Some people were given ownership of a place and the people in that place, they were called lords or knights, but they weren't enforcing laws, they were enforcing their will.
Some communities had expectations and rules, and the community was self policing - if you did theft, the mob would come punish you. They weren't enforcing laws and certainly weren't paid. Their justice was uneven and often brutal.
Sometimes soldiers would be pressed into enforcing laws, but they were being paid to be soldiers.
Eventually we got to some folks who were paid to enforce laws. Some of the earliest were "Shire Reeves" (from which we derive the word sheriff). A shire reeve was a single man who was charged with keeping order in a shire. That's not exactly enforcing laws, but it's close enough in spirit. A reeve would hire temporary folks in a posse if needed to achieve a temporary goal, but did not have a police department.
Temporary posses were not uniformed, and were typically paid for short term labor - arrest this guy or get that property back. A reeve may have guards for his safety or to intimidate local folks, but those guards weren't really law enforcement.
Around the fourteenth century, governments started relying on formal roles known as justices of peace, or conservators of peace, who were explicitly charged with binding people to laws and enforcing laws. They were relatively large in number and the practice continued through to the industrial revolution. Except JPs weren't paid, they were typically gentry who enjoyed the social status it granted them.
The history of US police is really fascinating, and not something most people really every dive into. They believe it was always this way, but it very much wasn't. Police as a concept like we know them is very, very modern.