Viljoen was noticed at primary school level, when he was selected in the Free State squad for the Under-13 Craven Week tournament in 2008. He then went to Grey College in Bloemfontein, where he was called up to a number of youth tournaments. He played at the Under-16 Grant Khomo Week in 2011, where he scored 18 points in two matches against and the. In 2012, he was included in the Free State's Under-18 Craven Week squad, scoring a try against KwaZulu-Natal and he played in the competition again in 2013, this time contributing a brace in their match against the. This led to Viljoen's inclusion in the South African Schools side for the 2013 international series, where he started two matches to help the South African side to victories over England and France. At the end of 2013, he moved to Cape Town to join. He was one of the Western Province Rugby Institute players that were invited to form part of the wider training group prior to the 2014 Super Rugby season. A knee injury ruled him out for part of the season, but he returned to action for the side during the 2014 Under-21 Provincial Championship, scoring five tries in five appearances, including a brace against the.
In March 2015, Viljoen was named in an extended South Africa Under-20 training group as part of their preparation for the 2015 World Rugby Under 20 Championship. He didn't feature in a friendly match against a Varsity Cup Dream Team or their two-match tour of Argentina, but was included in the final squad for the 2015 World Rugby Under 20 Championship. He wasn't named in the squad for their 33–5 win against hosts Italy in the first of their three matches in Pool B of the competition and was an unused replacement in their next match, a 40–8 win against Samoa. He started their final match, a 46–13 win over Australia to help South Africa finish top of Pool B to qualify for the semi-finals with the bestrecord pool stage of all the teams in the competition. Viljoen started their semi-final match against England, but could not prevent them losing 20–28 to be eliminated from the competition by England for the second year in succession and also started their third-place play-off match against France, helping South Africa to a 31–18 win to secure third place in the competition.
Cricket
Viljoen was also a cricketer at school and was called up to various Free State youth cricket teams.