Referring to Pinkett Smith's shaved hairdo, Rock said: "Jada, can't wait for GI Jane 2."
Smith walked up on stage and appeared to strike Rock before returning to his seat and shouting: "Keep my wife's name out of your... mouth."
Smith later apologised in a tearful best actor acceptance speech.
"I want to apologise to the Academy. I want to apologise to my all my fellow nominees," Smith said after winning the first Oscar of his career for playing the father of tennis legends Venus and Serena Williams in King Richard.
"Art imitates life. I look like the crazy father, just like they said about Richard Williams. But love will make you do crazy things."
Pinkett Smith has previously spoken about having the hair loss condition alopecia.
Rock looked shocked in the immediate aftermath of the incident, telling the audience: "That was the greatest night in the history of television."
He then handed over the best documentary prize, which was the reason he was on stage.
His joke referred to 1997 film GI Jane, in which Demi Moore played the title role with a buzzcut.
Inside the Dolby Theatre in Los Angeles, there was a shocked reaction from journalists to Smith's run-in with Rock.
Reporters had been taking part in the traditional backstage press conference, where the winners answer questions after delivering their acceptance speeches.
But attention suddenly turned to our overhead screens and what was going on at the ceremony, as it became clear something serious was kicking off.
At first, it had seemed like a joke or some kind of set-up. Smith even appeared to laugh at first after Rock delivered his line about his wife looking like G.I. Jane. Jada looked annoyed, but at this point it was still assumed this was all part of some kind of pre-planned routine.
Doubt began to creep in when Smith rose from his seat and hit Rock on the stage. Of course, both these guys are veterans of film and television, and would know how to carry out a fake stage slap. Except, everyone was starting to think, it didn't look that fake.
By the time Smith was sitting back in his seat and shouting to Rock to "keep my wife's name out your [expletive] mouth," it was clear this was no sketch. A professional like Smith would know better than to drop the F-bomb on stage during a live TV broadcast.
Viewers at home didn't hear the swearing. Broadcast network ABC had cut the live feed to avoid offending viewers at home.
Throughout the altercation, there was complete silence in the winners' room. Academy staffers looked just as shocked as the journalists did. "I thought they were doing a bit," one said to his colleague.
Rock, meanwhile, looked visibly shaken. But, realising he'd just made Oscars history, he made light of the situation, commenting: "That was the greatest night in the history of television."
Much like previous Oscars which were defined by their viral moments - such as Ellen's group selfie or the best picture winner mix-up in 2017 - this will now forever be the Oscars where Will Smith punched Chris Rock.