You’re right about the overall meaning. More specifically, in Westeros the “right of pit” part describes the lord’s authority to imprison people, and the “right of gallows” part describes the lord’s authority to execute people.
Interestingly, there was a right of pit and gallows, or “furca and fossa” in Medieval Scotland. However, the meaning was slightly different: instead, it refered to the right of a lord to execute people for crimes, the gallows being reserved for hanging men, and the pit being used to drown women.
