The 28-year-old central defender left St Mirren this summer under freedom of contract and has become the Ibrox club's second acquisition of the summer following the arrival of striker Kenny Miller on a Bosman transfer.
McGregor, who will be paraded officially later today, suffered two cruciate ligament injuries during his time in Paisley but returned to play regularly throughout the course of last season.
"I am absolutely delighted to get the chance to join Rangers," he said. "I will do everything I can to help this club get back to the top of Scottish football. I am sure next season's campaign will be a successful one. This is one of the biggest clubs in world football and I can't wait to play at Ibrox. It really is a dream come true."
Ally McCoist, the Rangers manager, has revealed he kept a close eye on McGregor as he proved his fitness last season and believes his pace will make the defender a valuable addition. "I watched St Mirren a number of times last year and he was a very consistent performer," added McCoist.
Rangers are chasing a number of other targets, with Kilmarnock forward Kris Boyd among them. Don Cowie has also been linked, although Cardiff City are hopeful the midfielder will sign a new two-year contract with them.