Specific
In this case, "Speak of the devil..." is a partial quotation of the idiom "Speak of the devil and he shall appear." (or one of its several variants).
General
"[Do something] and [something will happen]" is an elliptical construction that means "If you/one [do(es) something], [something will happen]".
Note that "do something" is an infinitive in the "[Do something] and [something will happen]". "something wil happen" is usually a present-tense or imperative verb form.
For example:
- "Feed a rat plutonium and it will soon die of radiation poisoning." = "If you feed a rat plutonium, it will soon die of radiation poisoning."
- "Push me and you're fired." = "If you push me, I will fire you."
- "Eat spinach and grow strong like Popeye!" = "By eating spinach, grow strong like Popeye!"
- "Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime." = "If you give a man a fish and you will have fed him for a day[...etc.]."
A similar construction replaces "and" with "or" to mean "if you don't do something, something will happen":
- "Drop your weapon or I shoot the hostage!" = "If you don't drop your weapon, I will shoot the hostage."
Note that "Speaking of groceries, I have to go to the supermarket in an hour." is a completely different construction.
Back to "Speak of the devil..."
The full form of the phrase is an example of the construction described above:
- "Speak of the devil and he shall appear." = "If one speaks of the devil, he shall appear."
So in essence, the idiom means that speaking of e.g. someone absent or some undesired situation is tempting fate, because that person or situation may appear.