The 34-year-old joined the Scottish Premiership outfit from Burnley over the summer but failed to make a single league appearance for the side, having previously made just two cup appearances in his two years with the Clarets.
Latics manager Warren Joyce said: "Matt adds competition to the squad and we are delighted to welcome him on board. He's a highly experienced keeper who has played in every division and knows the league inside out. We are delighted to have been able to secure his signature."
Earlier in his career, Gilks notched up 200 appearances for Blackpool - including 18 in the Premier League - as well as 197 appearances for hometown club Rochdale.