Margetić was born in 1920 in Donja Stubica. He finished the Classical Gymnasium in Zagreb and graduated from the Faculty of Law, University of Zagreb in 1945, where he obtained his Ph.D. in 1946. In 1948 Margetić moved to Rijeka, where he spent 20 years - 1956 to 1976 - working for Energoprojekt, a local company. In 1975 he began teaching at the University of Rijeka, becoming a full professor in 1980. He retired from the faculty in 1989.
Margetić's scientific focus was legal history of Ancient Rome, Greece and Byzantium, and - in particular - legal history of medieval Croatia. He authored more than 400 scientific works, including approximately 50 books.
Margetić was a full member of the Croatian Academy of Sciences and Arts and a professor emeritus of the University of Rijeka.