Sanji is a complicated character introduced early in the Baratie arc of One Piece. He eventually joins Luffy and the Straw Hat pirates, although his main quest is to discover the All Blue, a sea where fish from every ocean can be found at one location. Even the trauma that he suffers would have impacted his smoking habit.
Monkey D Luffy's journey starts with a crew and goes out to the Grand Line in an attempt to become King of the Pirates. The Baratie arc follows Luffy after acquiring a swordsman, Zoro, a navigator, Usopp, and a sharpshooter, Usopp. In this arc, he finally finds a cook, Sanji.
What Happened to Sanji?
Sanji's ship was sunk in a storm when it was attacked by pirates and sank by the captain of the pirate crew. Zeff gave Sanji five days' worth of food and recommended that he consume it every day for the duration.
When Krieg and his crew are finally rescued, they keep going and start an ocean-faring restaurant together. They wanted to make sure that no other person would have to suffer as a result of what they did. This does cause some serious trouble for the restaurant when it feeds Krieg and his crew, which gives them strength and encourages them to attack the restaurant.
Sanji's habit of smoking quickly becomes a main character trait, as does his hot-headed personality. Throughout the series, he is unlikely to be seen without his trademark cigarette, which is often representative of Sanjis's. While this does serve to set him apart visually from the others, it is unlikely that someone who suffered what Sanji went through would ever commit themselves to something such addictive.
Sanjis' trauma has been established numerous times that it still affects him profoundly to this day. He refuses to ever eat anything that isn't suitable, and if something does happen to him, he's extremely depressed by it. Despite the consequences faced by Krieg and his men, Sanjis refuses to let anyone go hungry, implying that at least the negative aspects of cigarettes will not weigh heavily on his mind.
Sanji and Cigarettes
Sanji's fear of food scarcity and his ability to envision life without something deeply needed is so deep in him that it has become his personality. Nonetheless, nicotine is also a substance that requires frequent use.
Sanji's decision to stop smoking makes no sense, much less why he would always have a cigarette in his mouth at all times. What will he do if he gets marooned again? Withdrawal, especially when one is weak, can kill a person.
The explanation for this may lie in the time setting of the story. Characters wear modern clothes, but there is no modern technology. Perhaps medicine has not advanced to the point where people are aware of what nicotine can do to a person.
It is possible that by the time Sanji realized that he was no longer able to use them anymore, he realized that he was no longer able to carry them with him. It is completely uncharacteristic of this deeply traumatized character, which serves to degrade his thoughts and actions if overlooked too much. From a simple surface-level character design standpoint, it does help set his tone as that of a noir era romantic cook fairly well.