Motors can generate high reverse voltages (you can look up more information on things like "reverse/back EMF" on the 'net) - the diode is placed there to catch those spikes which may otherwise disrupt or damage the rest of your circuit. For a small motor, you can use a common 1N4004 diode - the only thing to look out for is to make sure you put it the right way around!