Heat 2 tablespoons olive oil in a large saucepan or small pot over medium heat until shimmering. Add 1 diced medium yellow onion, ½ teaspoon dried Italian seasoning, ¼ teaspoon kosher salt, and ¼ teaspoon black pepper. Cook, stirring occasionally, until softened, about 5 minutes.
Stir in 1 (14.5-ounce) can drained and diced whole peeled tomatoes, 2 minced garlic cloves, and ⅛ teaspoon red pepper flakes if desired. Cook until fragrant, about 2 minutes.
Stir in 1 (32-ounce) carton low-sodium chicken broth, 2 cups water, 2 (15-ounce) cans drained and rinsed cannellini beans, and 8 ounces diced cooked ham. Bring to a boil over high heat. Reduce the heat to medium-low and simmer gently, stirring occasionally, until the flavors meld, about 30 minutes.
Turn off the heat. Stir in 2 ounces baby spinach if desired until wilted. Taste and season with more kosher salt and black pepper as needed.
