The 28-year-old has been without a club since being released by the Ibrox outfit in May 2016.
He had a trial with MLS side Vancouver Whitecaps but failed to win a deal, and has also trained with Dundee United.
Hamilton have, however, snapped up the former Hearts star as they bid to escape bottom spot in the Scottish Premiership table.
The Lanarkshire club revealed their "delight" at the deal on Twitter.
Templeton started his career at Stenhousemuir before making the switch to Hearts in 2007. He joined Rangers in 2012 and scored more than 20 goals for the club.
Hamilton Academical have signed former Rangers winger David Templeton on a deal until the end of the season.