The two important purposes of the buffer are to create the pH and to conduct the current. The buffer ions will carry the current during electrophoresis.
The pH set by the buffer determines the net charge on the solutes. The pH ionizes these solutes and the resulting net charge determines which electrode the solutes migrate toward. Besides setting the pH, the buffer also maintains the pH throughout the electrophoresis of the sample.