Heat olive oil in a large skillet over medium-high. Cook onion, garlic, and a pinch of the salt until onion is translucent. Add the tomatoes and half of the rosemary. Bring to boil, reduce to simmer, and cook uncovered until the mixture thickens slightly, (about 5 minutes.)
Add beans and half of the parmesan to the skillet. Stir to combine until the parmesan is completely incorporated. Season with crushed red pepper, salt, and black pepper to taste.
Pour beans into a 2 qt. baking dish. Sprinkle the rest of the parmesan and fontina cheese, and then rosemary on top.