Hebb's actual statement is:
Let us assume that the persistence or repetition of a reverberatory activity (or "trace") tends to induce lasting cellular changes that add to its stability. ... When an axon of cell A is near enough to excite a cell B and repeatedly or persistently takes part in firing it, some growth process or metabolic change takes place in one or both cells such that A's efficiency, as one of the cells firing B, is increased.
So, in Hebb's case we are talking about neurons that are already connected that then increase their strength of connection when firing of Cell B follows after excitation by Cell A.
Biologically, the plasticity mechanism best associated with Hebbian plasticity is called spike timing dependent plasticity (STDP). STDP utilizes a calcium signal mediated by NMDA receptors.
NMDA receptors are glutamate receptors but depend on simultaneous depolarization of the membrane to displace a magnesium block that is ordinarily present. NMDA receptors are best activated when they are already bound to glutamate (released from Cell A) when Cell B fires an action potential; the action potential propagates back into the dendritic tree as well as down the axon, and this displaces the magnesium block, allowing calcium to enter the cell.
The subsequent signaling cascade results in increases in post-synaptic AMPA receptors, which causes long term potentiation.
If cell B fires but cell A did not fire before it, then the action potential still propagates back into the dendrites but there is no glutamate present at synapses between cell A and cell B so those synapses are not potentiated.
Hebb, D.O. (1949). The Organization of Behavior. New York: Wiley & Sons.