Heat the oil in a large skillet over medium-high heat. Add the onion and cook until softened and translucent, about 5 minutes. Add the ham and garlic and cook for an additional 3 minutes. Stir in the beans, crushed tomatoes, water, molasses, mustard, vinegar, and pepper. Bring to a boil, then reduce the heat to a simmer. Cover and cook until about half of the liquid is absorbed, 15 minutes.