When placed in an electrical field, the negative charge found in the sugar-phosphate backbone of DNA polymers cause them to migrate towards the positive electrode.
In gel electrophoresis, electricity is used to separate fragments of DNA based on its length. DNA is place in a porous gel. The pores of the gel restricts the movement of the DNA. It then creates fragments on the DNA because its movement varies on its lengths.