In this work, we investigate the effects of torsion on electromagnetic fields. As a model spacetime, endowed with both curvature and torsion, we choose a generalization of the cosmic string, the cosmic dislocation. Maxwell's equations in the spacetime of a cosmic dislocation are then solved, considering both the case of a static, uniform, charge distribution along the string, and the case of a constant current flowing through the string. We find that the torsion associated to the defect affects only the magnetic field whereas curvature affects both electric and magnetic fields. Moreover, the magnetic field is found to spiral up around the defect axis.