Place the oil, a pinch of salt, and the sliced onion in a pan over low heat, stirring to coat. Continue to cook, stirring occasionally, until the onion slices are soft, golden brown, and caramelized, about 25-30 minutes.
Spread one side of each of the bread slices with the softened butter. On the other side, layer ½ the cheese slices, the ham slices, and the caramelized onions followed by the rest of the cheese. Spread the top piece of bread with the fig jam.
Place the sandwiches in a skillet over medium heat. Cook until the bottom is golden brown. Carefully flip the sandwiches over and cook the other side until golden brown and the cheese is melted. Serve the sandwiches warm.