The left-arm spinner, who has taken 203 wickets in 59 Test matches, will play first-class games in the first two months and then T20 Blast matches as the Proteas have no fixtures scheduled during that period.
Maharaj will be one of two overseas players at the start of the season for Leicestershire after being promoted to the first division, along with captain and Australia batter Peter Handscomb.
The 35-year-old Maharaj has previously featured in county cricket with Lancashire and Yorkshire.
"I've been digging into the history of the club, and it seems like a very exciting time to sign," Maharaj said. "The boys have done some exceptional work throughout the season and have built some great momentum heading into next year. It's early days, but we're tracking in the right direction, so who knows how far this team can go?"
Leicestershire's director of cricket, and former Proteas left-arm spinner Claude Henderson said: "It's fantastic to welcome Keshav to Leicestershire. Alongside his exceptional cricketing abilities, he will bring vast international experience, leadership skills, and a huge passion for the game - all of which will be fundamental to our changing room."
Another former Proteas international, Alfonso Thomas, is the current head coach of Leicestershire.