Free the slaves in the slave pen, for the Rangers

First of all for this quest, YOU CANNOT BE A SLAVER!

Talk to the Rangers in their club house and ask to join; afterwards you'll be ordered to free the slaves outside.

Take out all the slavers and go ahead and use your science or repair skill on those cells (keep repeating even if you fail).

Return to the club house to get your ranger pin.

There is also a way to free the slaves without resorting to violence, though this requires exploiting the game mechanics in combat. You can flee from a combat by just walking to another area as you know, same goes here. If you iniate combat with one of the guards they will all come after you. When they do, simply walk back to the city with the men after you and once you get in, the men will stop near the entrance. After this you may simply sneak in and free the slaves without killing a soul.

As long as you are not seen by the patrolling guard, you're able to simply try each gate until all the slaves are free and simply walk out.