VIDEO: Hansen - Sonny Bill didn't know the rules
Hansen admitted his star mifielder had no idea about the rule that led to his yellow card.
New Zealand held off the hosts at the Stade de France to claim a 38-18 win in their Test at the weekend.
But the All Blacks stuttered early in the second half, when Les Bleus were awarded a penalty try after Williams inexplicably deliberately slapped the ball over the dead-ball line.
However, Hansen defended the 32-year-old, saying Williams was unsure about the rule, as a result of his long career in Rugby League.
"The Sonny one was, he doesn't know the rules," the coach said, adding: "He was playing League [for so long] and in League you're allowed to smash it over the dead-ball line.
"I got a lesson myself from Fozzie [assistant coach Ian Foster] that once you've committed an offence in the goal area then it's like you're not there, they make you invisible and they felt the Frenchman was going to catch the ball so it was a try. You can't do too much about that."
"It was a good lesson for Sonny, he'll know next time to catch it rather than bat it over the line."
His Rugby League skills, however, created a try in th first half when Ryan Crotty pounced on Williams's grubber kick to notch the 2,000th All Blacks try in international rugby.
"I had no idea, that's pretty cool," admitted Crotty of his landmark.
"It was a pretty nice kick he put through for me. I didn't really have to do too much so I give him a pat on the back for that."
The All Blacks had been cruising, taking a 31-5 half-time lead before France rallied to get within 13, but New Zealand closed out their win.
Hansen said his side's ill-discipline almost proved costly, but he was happy with the way his team dealt with the pressure put on by the hosts.
"I think we lost our discipline a little and as a result of that we allowed the momentum to shift and the French were good enough to take that opportunity and put us under pressure," he said.
"Having said that, I was very happy with the way we fought our way through it and scored a good try at the end.
"We scored enough points in the first half to get the job done."
Hansen admitted to feeling frustrated despite the All Blacks romping to victory over France.
But with what on paper looked like their hardest November Test negotiated with a convincing victory – ahead of trips to Scotland and Italy – Hansen wasn't going to be too tough on his players.
"It's very difficult in sporting occasions for any team or person to hold the momentum for the whole duration of the contest," he added.
"Once we lost momentum the French team got confidence and put us under pressure, so it's all part of that process of trying to get better.
"We gave away 11 penalties I think in the second half and some pretty basic ones from just being offside.
"Those things allowed our opponents to get back into the game."