Preheat the oven to 180°C. Drizzle oil over the exposed garlic heads, wrap tightly in aluminium foil, and roast until golden brown and tender, about 60 to 90 minutes.
Heat oil in a large saucepan over medium heat. Add diced onion and cook until softened, about 5 to 7 minutes.
Add chopped garlic to the pan and cook, stirring frequently, until fragrant, about 1 minute.
Add broth, white beans, and rosemary to the saucepan. Bring to a boil, then reduce heat and simmer gently for about 5 minutes.
Squeeze the roasted garlic cloves from their skins directly into the soup mixture.
Purée the soup using a countertop or immersion blender until completely smooth and creamy.
Stir in lemon juice, season with salt and pepper, and serve immediately for best flavor!