C1 and the resistance of the speaker are acting as a "C-R differentiator"
This circuit is described at
http://en.wikipedia.org/wiki/Passive_differentiator_circuit but this description immediately jumps into heavy maths, so unless you're a mathematician or physicist, don't bother with it.
In short, when the time constant of the capacitor and the resistor is small compared to the period of the square wave, the differentiator will turn the signal into a series of positive-going and negative-going spikes. If you want to avoid this, you need to increase the time constant so it's significantly greater than the period of the waveform.
The time constant is the capacitance (in Farads) multiplied by the resistance (in ohms). The answer is in seconds. With C1 = 0.1uF and R = 8 ohms (I will assume), T = 0.1e-6 * 8 which is 0.8 microseconds. The period of an 18 kHz waveform is 56 microseconds. So you need to increase the time constant by a factor of about 70. Increase C1 to at least 7 uF and the problem should get better. Increase C1 even more, and the curves in the waveform you see across the speaker will eventually go away.
This change will increase the loading on the output of your frequency source. This will probably affect the waveform at its output. You may need to insert a buffer of some kind between the frequency source and C1.
Inserting a series resistor of, say, 100 ohms will improve the waveforms and reduce the loading on the frequency source, but will greatly reduce the amount of energy at the speaker.
Using a speaker with a higher resistance, e.g. 32 ohms, and/or a matching transformer, will help.