The 33-year-old defender has played in all four tiers of English football, having begun his career in the Premier League with Fulham before subsequent moves to Queens Park Rangers and Bradford City.
Rehman has since spent time in the Far East, playing for Muangthong United in Thailand, Kitchee in Hong Kong and, most recently, Malaysian Super League Side Pahang FA.
"I had a chat with the head coach, I was really impressed with what he had to say, and I'm hoping I can use my experience to help the team. I've spent six years and clocked up over 200 games playing overseas, so it's good to be back in England," the Pakistani international told the club's official website.
"I'm looking forward to rolling my sleeves up and helping in the fight to move the club up the Sky Bet League One table. I watched Tuesday's draw against AFC Wimbledon and thought the boys did enough to win, so it's clear I'm joining a talented squad of players. If we all pull in the same direction and never give up, I'm sure we can get a few wins on the bounce."
Manager Adrian Pennock added: "As everybody knows, I've been after an experienced centre-back for a few weeks and I'm very pleased to get Zesh on board. He'll give us his experience and brings with him great knowledge of this division."
Rehman, who will wear the number 31 shirt at Priestfield, could make his debut against Southend United on Saturday.