Gerrit Viljoen was born in Cape Town on 11 September 1926 to Helena and Hendrik Geldenhuys Viljoen. At the time of his birth his father was the editor of Huisgenoot Magazine. After his family relocated to Pretoria, Viljoen started his schooling at Pretoria Oos Laerskool from 1933 to 1939. He also attended the Afrikaanse Hoer Seunskool in Pretoria and matriculated in 1943. He enrolled at the University of Pretoria, where he completed a master’s degree in Classics and LLB. While at University of Pretoria, Viljoen played an active role in politics and served four years on Students Representative Council (SRC). He was also instrumental in the formation of a United Afrikaans students’ Organisation in 1948.
Viljoen later enrolled at the University of Cambridge, where he obtained an Masters degree and a D Litt et phil at the University of Leiden in 1955, based on research into poetry of Pinder, a classical Greek poet and author. Upon his return from his studies overseas he was appointed senior lecturer and professor at the Classics department at the University of Pretoria. In 1967 he was appointed rector of the newly established Rand Afrikaans University.
During his academic career Viljoen sat on various councils and was also chairman of numerous boards. In 1978 he was appointed administrator of South West Africa (Namibia), a position he held until appointed Minister of National Education in 1980. Between 1984 and 1990 he served in various ministerial positions. He was one of the National Party delegates Convention for a Democratic South Africa (Codesa) between government and political organisations. In May 1992, Viljoen took ill because of the intense pressure from the Convention for a Democratic South Africa. In the very same year he was implicated in the Justice Pickard report, which investigated corruption in his department while as Minister of Education in 1984-1989, of as having misuse billions of rands of the state funds.
Viljoen is married to Magdalene and they have seven children.