The 36-year-old had been without a team all summer, following the expiration of his contract with the Hammers.
The veteran is now a Hornet and will be hoping to bring the club back into the Premier League.
"It is very important to bring in some experience, like with Moussa (Sissoko)," Ogbonna told the club website.
“I have spoken with the manager a couple of times, so I know his style of play. I am here to try my best and to try to help the team.”