The central dogma of molecular biology: DNA makes RNA makes Protein
DNA is a reference for proteins*, which are the functional molecules in cells. These are comprised of 20 unique amino acids, and each is coded for by a stretch of DNA known as a codon. Codons are always 3 base-pairs (nucleotides) in length.
DNA is made of 4 unique nucleotides; (A)denine, (G)uanine, (C)ytosine and (T)hymine. This means that there are 64 unique codons that can be made with these 4 bases (4*4*4).
Theory One - evolvability
If codons were only 2 bases in length then the variety of codons that could be created would be less (only 16 unique sequences if there are still 4 nucleotides). More unique nucleotides would be required to get enough unique sequences to code for the 20 amino acids (as well as the STOP codons). For instance, to get 64 unique sequences using a 2-bases-per-codon system there would need to be 8 unique nucleotides.
We cannot ever 'know' what happened in evolutionary terms, but it seems likely that the 3-base (nucleotide) codon system would have arisen after a period of a 2-base system, as the biological systems became more complex. This would have allowed a lot more variation in the amino-acids used, and thus more "evolvability", which would have been very advantageous to early organisms.
However as the 4-unique-nucleotide/3-codon system is ubiquitous to all life we have discovered on earth, it seems likely that, back at the start of DNA (in fact probably RNA), this was the system that worked, or at least, this is the one that survived (although as Kevin rightly points out, we don't know whether there ever were any other systems). Variations may have arisen over the years, but it is this 1 system that has prevailed here on Earth.
See this question for some more interesting info: why-20-amino-acids-instead-of-64?
Theory Two - "redundancy" of codons conveys additional information
This theory is not mutually exclusive to the one described above. In a recent paper D'Onofrio and Abel [1] state that ribosomes pause for different lengths of time at different codons (even if the codon codes for the same amino acid), and that this pausing affects the 3-dimensional structure of the final protein.
Therefore the nucleotide sequence contains at least two "layers" of information: firstly which amino-acid should be added, and second the specific codon used for that amino acid can impact on the final structure of the protein. This could not be done with fewer nucleotides, but arguably even more control could be exerted with more nucleotides, but perhaps this comes back to my first point that this system evolved such a long time ago that more nucleotides were not necessary for life to "work" and proliferate into everything we see today.
- D'Onofrio and Abel, 2014. Frontiers in Genetics. Redundancy of the genetic code enables translational pausing
*only around 1% of our genome is actually protein-coding, and many non-protein-coding RNA products have very important functions, but I won't go into this here. Suffice it to say I am referring to the protein-coding regions of the DNA.