A quantum-mechanical model for the interaction of Josephson vortices (fluxons) embedded in a superconducting transmission line is presented. The vortices interact through emission and absorption of linear waves (electromagnetic cavity modes). We show that in a classical regime this peculiar type of interaction is determined by the product of instantaneous velocities of fluxons. In a quantum regime, this property provides tunable coupling between vortices which can be used for entanglement of vortex qubits. The physical mechanism of the vortex interaction is similar to that proposed for qubits based on trapped ions. Different types of transmission lines mediating the vortex interaction are proposed.