Hallberg completed his basic education at Lund University, where he obtained a Master of Science (MSc) in chemistry and physics in 1969. The following year he attended the School of Education in Malmö obtained a BScEd and worked thereafter as a teacher in the junior high school from 1970-1973.
Hallberg returned to Lund University and the Chemical Centre, to conduct research in 1973-1979. In January 1980, he received a Doctor of Philosophy (PhD) in organic chemistry with the thesis “[http://libris.kb.se/bib/196594 Methoxythiophenes and Related Systems]”. After six months as a researcher at Nobel Chemistry in Karlskoga, he completed the post-doctoral period at the University of Arizona, Tucson, Arizona, where he then was promoted to a position as assistant professor at the College of Pharmacy in 1981-1982. On his return to the Chemical Centre in Lund in 1983, he was appointed associate professor (docent).
He received grants from the Swedish Research Council and stayed at Lund University until 1986, when he took up a managerial position within the pharmaceutical company AstraDraco in Lund. Eventually he became Director and Head Medicinal Chemistry and only in 1990 did he leave the company to be installed as a Professor of medicinal chemistry at Uppsala University. During the twenty years that followed, he worked at the Uppsala Biomedical Center (BMC), but kept in touch with his old company, now Astra Zeneca, through an assignment as a research advisor.
One year after arriving at Uppsala, in 1991, Hallberg became Chairman of the Department of Organic Pharmaceutical Chemistry and from 1992 to 1996 he acted as Dean for Research at the Faculty of Pharmacy. He served for many years as Chairman of the Evaluation Panel for Chemistry at The Swedish Research Council in Stockholm and as Chairman of the Medicinal Chemistry Section at The Swedish Academy of Pharmaceutical Sciences. During the period 2002-2005, he was Deputy Vice President (Medicine/Pharmacy), before taking over as Dean of the Faculty of Pharmacy in 2005. Hallberg was then elected Rector Magnificus (Vice Chancellor) for Uppsala University from 1 July 2006.
As Vice Chancellor, Hallberg initiated Quality and Renewal (KoF07) in 2007, a comprehensive international evaluation of the universitys research that was followed four years later by KoF11. In 2008, he took the initiative to Uppsala Universitys collaboration with the Royal Institute of Technology, Stockholm University and the Karolinska Institute with the aim to build the biomedical center formation Science for Life Laboratory (SciLifeLab). Hallberg was also one of the initiators to the collaborative organisation U4 Network, founded in 2008 and currently uniting a number of European universities, as well as the international Matariki network of universities (MNU), founded in 2010. In 2011, Hallberg and Jörgen Tholin, then Vice Chancellor of the University of Gotland, signed a declaration of intent on the merger of Uppsala University and the University of Gotland[https://www.uu.se/press/pressmeddelande/?id=1562&typ=pm].
He was succeeded as Vice Chancellor on 1 January 2012 by Eva Åkesson.