If I remember correctly, he filmed the commercial before his death to be used as a Cancer awareness ad.
Here's an article about the ad.
Twenty years ago, Yul Brynner, dying from lung cancer, made a television commercial that said, "Now that I'm gone, I tell you: Don't smoke, whatever you do, just don't smoke." Brynner was very much alive in January, 1985, when he made this statement on ABC's Good Morning America. But after he died in October of that year, he got his wish. The resulting public service announcement remains one of the most memorable antismoking statements ever made
Source
The Yul Brynner Head and Neck Cancer Foundation