Cook onion and, if desired, ground beef in a Dutch oven, stirring until meat crumbles and is no longer pink; drain. Stir in bacon and remaining ingredients, and spoon into a lightly greased 2 1/2-quart baking dish. Chill 8 hours, if desired.
Bake bean mixture at 350 for 1 hour, stirring once.