Thomas has made more than 80 appearances for the Dragons since joining them from the Scarlets in the 2006-07 season.
Thomas, who has been capped by Wales at Sevens level, said: "I've played at Kingsholm twice in the last few seasons, once in the Heineken Cup and once in the LV= Cup. Although I was with the opposition, I couldn't help but be impressed by the match-day atmosphere."
Gloucester head coach Bryan Redpath said: "Olly Morgan is obviously recovering from knee surgery and we've been using Jonny May and Tom Voyce in the full-back role since Morgs got injured.
"What Martyn will give us is another specialist full-back in the squad. He's the sort of player whose style of play should see him fit in well here and we look forward to him arriving in the summer."