The 30-year-old midfielder has dropped down the pecking order at Vicarage Road in recent months and will cost Rangers an initial fee of £200,000 to buy out his existing contract.
Mahon told the Hoops' official club website: "It's a very exciting time to be joining this club.
"There were four or five other Championship sides that showed an interest, but once I'd spoken to the chairman, Gianni Paladini, there was never any doubt in my mind I'd be joining Rangers.
"The ambition and drive of the board and the new investors really impressed me and I'm delighted to be here."
Mahon had been with the Hornets for almost six years, having joined the club from Brentford for £50,000, while his senior debut came during his time with Hereford United.