The effect of secondary structure on DNA duplex formation is poorly understood. We use a coarse-grained model of DNA to show that specific 3- and 4-base pair hairpins reduce hybridization rates by factors of 2 and 10 respectively, in good agreement with experiment. By contrast, melting rates are accelerated by factors of ~100 and ~2000. This surprisingly large speed-up occurs because hairpins form during the melting process, stabilizing partially melted states, and facilitating dissociation. These results may help guide the design of DNA devices that use hairpins to modulate hybridization and dissociation pathways and rates.