The music for the Pontifical Anthem and March was composed in 1869 by Charles Gounod for the celebration on April 11, 1869 of Pope Pius IX's silver jubilee. In 1949, Pope Pius XII decided that it would become the papal anthem, and Antonio Allegra, one of the organists of St. Peter's Basilica, wrote Italian lyrics; in 1991 Raffaello Lavagna wrote new lyrics in Latin. If you'd like to read both versions, you can find them on Wikipedia.
Today the march is played at solemn State occasions and ceremonies in which the Pope is present. When the Vatican's flag is ceremonially raised, only the first eight bars are played.
In case, like me, your education didn't include the Pontifical March, here's a version: