Select a site for the pen with good shade and drainage. Ideally, a sheltered pen will be close to your house so you can keep an eye on the ducks and create an attached or nearby outdoor pen for them to use in the daytime. For every three ducks you will house, allow about one and a quarter square yards of space.
If the area stays dry, it's fine to have a dirt or gravel floor. Lay a cement slab for a rainy climate. For dirt or gravel floors, place a layer of hardware cloth under the floor to prevent burrowing predators from getting in. Plan to cover the floor in straw bedding and change it frequently.
Place 4 x 4 posts a little more than a yard apart to form the outside walls of the pen. Sink them 1.5 feet into the ground and allow 5 to 6 feet above ground. Staple strong wire mesh or heavy gauge galvanized fencing to the posts, sinking the fencing into the ground right along with the buried section of the support posts. Burying the fencing as well helps to keep predators from digging under your fencing to get at the ducks. Line the bottom three feet of the fencing, inside the enclosure, with predator-proofing hardware cloth for the ducks to sleep against at night. Line the outside perimeter of the pen with concrete blocks or heavy stones to further discourage digging. If desired, keep one section between posts open for a door.
Make a 2 x 4 wood-frame screen door, using flat, 90-degree angle braces on the corners of the back of the frame for extra stability. Be sure the door is the same ground-to-roof height as the support posts. Staple wire mesh or fencing to the frame and hinge the door to swing outward between two support posts. Put a secure latch on the door--one that is raccoon-proof--and place pavers or flat cement blocks at the doorway, like a small step, to prevent any digging there.
Build a roof frame out of 2 x 4s and cover it in wire mesh or hardware cloth. Attach the roof to the support posts, at a slant from front to back. The slight slope allows rain run-off and keeps water from pooling on the roof. Fasten tarps to the roof to protect the ducks from inclement weather. Alternatively, you could build a wooden roof for the pen with sheets of 5/8- or 3/4-inch plywood; just be sure the roof slants and meets the side walls or mesh.