Toss the green beans into a large pot of boiling salted water and cook until bright green in color and crisp-tender, about 5 minutes. Drain the beans and shock in a large bowl of ice water to stop the cooking. Drain the beans again and pat dry.
Cook the bacon in a large, heavy saute pan until crisp, about 5 minutes. Remove the bacon to a paper towel-lined plate to drain. Spoon off the excess bacon grease, leaving 2 tablespoons in the pan. Add the onion to the pan and saute until soft and very tender, 4 to 5 minutes. Sprinkle in the garlic and red pepper flakes and saute until just fragrant, about 1 more minute. Add the reserved green beans and the pecans and cook until heated through, 5 to 6 minutes more. Return the bacon to the pan, pour in the lemon juice and toss. Season with salt and pepper.