Uncapped Williams, the son of ex-Wales and British and Irish Lion Brynmor, helped the Barbarians beat Wales in Cardiff on 4 June as a replacement.
Williams' call-up follows Scarlets hooker Ken Owens coming in as cover for Richard Hibbard.
Osprey Hibbard has undergone shoulder surgery and is out for 10 to 12 weeks.
Williams, 21, could figure in Wales' three World Cup warm-ups along with Owens as they face England twice and Argentina.
Prop Gethin Jenkins is back in full training after toe surgery in January.
The Cardiff Blues loose-head, who has not played since 7 January, was joined by Exeter-bound tight-head prop Craig Mitchell in training, as Wales began their conditioning programme ahead of September's Rugby World Cup.
Mitchell has been out since dislocating his shoulder in Wales' Six Nations win over Ireland in March, so the return of Mitchell and Jenkins coupled with Owens' call-up has bolstered Gatland's Wales front-row options.
Wales' record try-scorer Shane Williams and fellow wing Leigh Halfpenny are also expected to be back at full fitness when the Welsh squad fly out to Poland on 2 July for their first summer training camp.
Ospreys star Williams, who has scored 53 tries in 79 Wales internationals, has been out with a knee injury since March, while Halfpenny continues his rehabilitation after a foot operation.
"Shane will be three more weeks before he is fully integrated into the training programme," said Prav Mathema, Welsh Rugby Union national medical performance manager.
"He should be up to speed by the time we go on that first camp in Poland.
"Leigh is doing well after a successful operation on his foot, he is six weeks down the line now and able to start lifting weights again and also hopes to be at Spala.
"Both Gethin and Craig are back in full training and Richard has been given a return to play time of 10 to 12 weeks, which makes it possible for him to be back to fitness by the end of August."
Wales begin their World Cup campaign in New Zealand against defending champions South Africa on 11 September.
But Gatland's men face England at Twickenham on 6 August, host England in Cardiff on 13 August and welcome Argentina to the Millennium Stadium on 20 August.
The Wales coach's final World Cup squad selection will be announced on 22 August, with the squad due to fly out to New Zealand on 31 August.
WALES PRELIMINARY RUGBY WORLD CUP SQUAD
Huw Bennett (Ospreys), Lloyd Burns (Dragons), Richard Hibbard (Ospreys), Matthew Rees (Scarlets), Ken Owens (Scarlets); Scott Andrews (Cardiff Blues), Ryan Bevington (Ospreys), Paul James (Ospreys), Gethin Jenkins (Cardiff Blues), Adam Jones (Ospreys), Craig Mitchell (Exeter Chiefs), John Yapp (Cardiff Blues); Luke Charteris (Dragons), Bradley Davies (Blues), Alun Wyn Jones (Ospreys), Lou Reed (Scarlets); Gareth Delve (Melbourne Rebels), Toby Faletau (Dragons), Ryan Jones (Ospreys), Dan Lydiate (Dragons), Rob McCusker (Scarlets), Andy Powell (Sale Sharks), Jonathan Thomas (Ospreys), Justin Tipuric (Ospreys), Josh Turnbull (Scarlets), Sam Warburton (Blues), Martyn Williams (Blues)
Tavis Knoyle (Scarlets), Dwayne Peel (Sale Sharks), Lloyd Williams (Blues), Richie Rees (Blues); Stephen Jones (Scarlets), Rhys Priestland (Scarlets), Jason Tovey (Dragons), James Hook (Perpigan); Andrew Bishop (Ospreys), Jonathan Davies (Scarlets), Gavin Henson (Unattached), Jamie Roberts (Blues); George North (Scarlets), Aled Brew (Dragons), Morgan Stoddart (Scarlets), Scott Williams (Scarlets), Shane Williams (Ospreys); Lee Byrne (Clermont Auvergne), Leigh Halfpenny (Blues).