The first crack occurs when the moisture inside the bean heats up enough to become steam and causes the shell of the bean to snap, making a sharp crack sound. With this expansion, the outer skin of the bean will come off, creating all that annoying chaff in your roaster.
The second crack is farther along into the roasting process, when the beans heat up even further and actually start to cook. The cell walls break down within the coffee bean, making a softer crack. At this point, oils are released from inside the bean and the real flavour of your coffee is developed.