I think it is the negative electrical charge. DNA is negatively charged, and therefore when an electric current is applied to the gel, the negative charge will repel DNA, thus DNA will migrate towards the positively charged electrode. Shorter strands of DNA move more quickly through the gel than longer strands resulting in the fragments being arranged in order.