Semper Fidelis is a Latin motto translating to "always faithful". Semper Fi is just a short version of that.
http://www.mca-marines.org/leatherneck/faq.htm#SemperFi
When did the term "Semper Fi," an abbreviation of Semper Fidelis, come into being?
Although not exactly recorded in history, one story stands out.
Sometime shortly after the Beirut bombing in 1983, then–Commandant of the Marine Corps General Paul X. Kelley was visiting a wounded Marine in the hospital. The lad shook the Commandant's hand and then scribbled the words "Semper Fi" on a piece of paper. It was the Marine's way of saying "Semper Fidelis." Gen Kelley became emotional and said, "Lord, where do we get such men?" The press picked up on it.
After that the term "Semper Fi" was given new life and a new meaning among Marines. However, for older Marines, the term had a slightly different meaning. Today while one understands "Semper Fi" to be a Marine greeting, in the past. "Semper Fi, Mac" meant "I got mine, how you doing?"