In a medium saucepan over medium heat, cook chopped bacon until it begins to brown and render its fat, about 4 to 5 minutes. Do not cook until fully crispy.
Add green beans with their liquid to the pan.
Stir in chopped onion, sugar, salt, and pepper.
Bring to a gentle boil, then reduce heat to low. Cover and simmer 35 to 40 minutes, stirring occasionally, until beans are tender and deeply flavored.
Taste and adjust seasoning. Serve with a slotted spoon, keeping the beans, onion, and bacon together while leaving excess liquid behind.