You can think of the speaker as the coil of an electromagnet. Connecting any kind of a DC source across the terminals won't do much in the sound department. If the source has enough current it might produce some magic smoke as it vaporizes the wire in the coil.
Connect an AC source and now the speaker cone will vibrate in sync with the AC signal and produce -- SOUND. Does this mean you can plug the terminals into a wall socket? NO too much current -- magic smoke, burnt fingers, yadda yadda yadda.
Google for "Audio Amplifier Circuits" to find examples of circuits for driving speakers.