Why is this diode here?
When the opamp output voltage falls the capacitor C2 charges trough the base of Q2 until the capacitor positive terminal reaches a voltage so high that current cannot flow anymore. As Q2 is a pnp transistor this current trough the base causes it to conduct, charging C3.
When the opamp output begins to rise again, the negative terminal of C2 is brought up in voltage, which raises the voltage of the positive terminal as well since the capacitor wants to maintain its state of charge. When the positive terminal of C2 reaches a voltage relative to ground higher than Vcc + 0.7, C2 discharges trough D1 into Vcc, enabling it to recharge again when the opamp output falls again.
In short, a rising waveform allows the capacitor to discharge trough D1, while a falling waveform allows the capacitor to charge trough Q2. The current let into C3 is directly proportional to how much and how often the opamp voltage falls. The resistor R5 then slowly bleeds off the charge accumulated in C3.  

C2, D1, Q2, C3 and R5 form a circuit called an "envelope detector": C3 is charged to a voltage proportional to the integrated amplitude of the output of the opamp.  

I think that the opamp is superfluous. You already have a (common emitter) voltage amplifier, which in addition to boosting the signal for the envelope detector has a high input impedance, effectively isolating the input side from the rest of the circuit.  

Update:
If you operate the circuit without D1, C2 will just keep charging until reaching the largest voltage between the opamp output and Vcc seen during operation. This happens because C2 will have no discharge path during positive peaks. At low amplitudes (less than 5V pk-pk) Q2 will eventually  stop conducting when C2 cannot accept more charge trough the base (this is why the LEDs require greater amplitudes to turn on). At higher amplitudes the positive terminal of C2 will exceed 5V relative to Vcc during positive opamp peaks. Most PNP transistors cannot tolerate great emitter-base voltages, having a never-exceed breakdown voltage of -5V or -6V (datasheet of BC557, 2N2222, 2N3904). This out of specification voltage will trigger an avalanche breakdown that finally allows the capacitor to discharge by forcing current trough the transistor in reverse. Not good.