It's frustrating when uninvited guests harvest the produce from your vegetable garden before you do. Both rabbits and deer are notorious for taking advantage of the vegetables humans plant, and while there are several ways you can keep your garden safe, marigolds will not do the trick. You'll have to find other methods to keep your garden safe from visiting critters.
Marigolds (Calendula, Caltha and Tagetes spp.) are usually grown as annuals, though the marsh marigold (Caltha palustris) is winter hardy to U.S. Department of Agriculture plant hardiness zones 3 through 7. Their bright flowers in ranges of red, orange, yellow and white make them vibrant choices for borders and beds, as does their long bloom time: Tagetes varieties, for instance, will bloom from spring or early summer until the first frost. Marigolds have a strong, spicy smell that is largely responsible for the myth that they work well as repellents.
Marigolds as Repellents
There is little to no evidence showing that marigolds are effective as repellents at all, much less against rabbits and larger mammals such as deer. While deer tend to avoid marigolds if there are other, better plants nearby, rabbits have been known to enjoy and destroy large quantities of marigolds at one time. Not only do they not provide protection for other plants, marigolds cannot protect themselves. There is some evidence that marigolds, when grown for two months, chopped up and turned into soil, may secrete substances that repel soil-dwelling nematodes, and so protect garden plants in that fashion.
Because marigolds do not work as a repellent, a better bet is to engage in cultural control. Removing habitat for rabbits -- briar patches, piles of wood or other materials, dense shrubs -- may keep them away from your yard. This is impractical for deer, unfortunately. Commercially available chemical-based repellents will not work once veggies fruit, because they are unsafe for human consumption, though you can apply them before fruit appears. Organic substances, including human hair and blood meal, may also frighten off deer, though not reliably.
The best way to keep your vegetable garden safe is to ensure that deer and rabbits cannot get to it in the first place. Electric netting and electric fencing are both very effective. While the former is small and more mobile so you can use it for whatever site requires protection, the latter is stronger and more stable for long-term repulsion. Be sure to warn children that electric fencing is dangerous, and to keep an eye on pets or young children until they learn to stay away from it.