Petty, 44, was also ordered to pay a $55,000 fine as part of his sentence of three years' probation and a year in home detention, according to the U.S. Attorney's Office.
He pleaded guilty last year to the federal charge of failure to register.
More than two decades before he married Minaj in 2019, Petty was convicted of attempted rape in New York in 1995 -- for an incident that occurred with a 16-year-old girl in September 1994. He served about four and a half years in prison and, as a condition of his conviction, he must register as a sex offender whenever he moves.
He and the "Bang Bang'' rapper moved to California after their marriage. The couple have a son who is nearly 2 years old.