Heat oil in a large nonstick skillet over medium-high heat.
Add onion and cook, stirring often, until soft and golden, about 7 minutes.
Stir in pear and cook, stirring often, until slightly soft and heated through, 1 to 2 minutes.
Add vinegar and pepper and continue cooking, stirring often, until the liquid has evaporated and the onion is tender and coated with a dark glaze, about 2 minutes more.
Divide the onion-pear mixture among the pitas; sprinkle with cheese and walnuts.
Transfer the pitas to a large baking sheet and bake until crispy and the cheese is melted, 10 to 15 minutes.