Preheat the oven to 450 degrees. Line a baking sheet with foil or parchment and brush with olive oil. Slit the eggplants down the middle, being careful not to cut through the skin. Place on the baking sheet and bake for 20 minutes, until the outer skin begins to shrivel. Remove from the oven and transfer, cut side down, to a colander set in the sink. Allow to drain for 30 minutes.
Meanwhile, heat 2 tablespoons of the olive oil over medium heat in a large, lidded skillet and add the onions. Cook, stirring often, until the onions are very tender, 5 to 8 minutes, and add the garlic. Cook, stirring, for 30 seconds to a minute, until fragrant. Remove from the heat and transfer to a bowl. Add the tomatoes, herbs, salt to taste and 1 teaspoon of the sugar and 1 tablespoon of the remaining oil.
Turn the eggplants over and place in the pan, cut side up. Season with salt. Fill with the onion and tomato mixture. Mix together the remaining olive oil, the remaining sugar, the water and the lemon juice. Drizzle over and around the eggplants. Cover the pan and place over low heat. Cook gently for 1 to 1 1/2 hours, checking the pan for liquid and basting from time to time with the liquid in the pan, and adding water to the pan if it becomes too dry. By the end of cooking the eggplants should be practically flat and the liquid in the pan slightly caramelized. Spoon this juice over the eggplant. Allow to cool in the pan, and serve at room temperature.
Tip
Advance preparation: You can roast the eggplant through Step 1 and make the filling through Step 2 several hours before assembling and cooking the imam bayildi. Once cooked, the finished dish can sit for several hours.