Place navy beans into a large container and cover with several inches of cool water; let stand 8 hours to overnight.
Drain navy beans and put into a pot with 5 cups water.
Bring water to a boil; reduce heat and simmer until beans are tender, about 1 hour.
Preheat oven to 250 degrees F (120 degrees C).
Combine beans, onion, brown sugar, molasses, vinegar, mustard, garlic, nutmeg, and cinnamon in a 2-quart casserole dish with a lid; season with pepper. Place lid on dish.
Bake in the preheated oven, 5 to 7 hours, stirring halfway through and adding water if mixture is too dry. Remove lid and bake until mixture has reduced to desired thickness, about 1 hour more.