Jonas learned the same lesson that everybody learns when they spend a day at the beach without sunscreen. Jonas learns that sunshine has a sort of Yin and Yang duality. It can bring pleasure, and it can bring pain.
It seems odd that Jonas wouldn't know this, but then again, he lives with the "Sameness." Everything is moderate, medium, and incredibly controlled. There is no hate, but there is also no joy. There isn't pain, but there also isn't pleasure. As for why Jonas wouldn't know about the sun and its warmth, the chapter also tells the reader that climate control is present for every second of people's lives now.
"And it [the sun] came from the sky." "That's right," the old man said. "Just the way it used to."
"Before Sameness. Before Climate Control," Jonas added.
Jonas is new to being the Receiver, so the Giver starts with an easy lesson about pleasure and pain. The Giver lets Jonas experience the wonderful warmth of actual sunlight.
It was not as exciting as the ride through the snowy air; but it was pleasurable and comforting.
Immediately after that lesson about sunshine being pleasurable, the Giver gives Jonas a lesson about painful sunshine.
He opened his eyes, wincing with discomfort. "It hurt," he told the man, "and I couldn't get the word for it."
"It was sunburn," the old man told him.
So from one object, Jonas learned two lessons: one about pleasure and one about discomfort.
The Giver used the sun to show pleasure and pain. Remember, that the people of the society including Jonas up to this point did not know real pleasure or pain. First, the Giver placed his hands on Jonas's back and transferred the memory of the warmth and pleasure derived from the sun. Jonas then saw the sun as a source of pleasure.
Jonas then told the Giver he was ready to experience pain. Knowing that Jonas could handle very little, the Giver gave him the experience of a sunburn. It did cause Jonas pain and the Giver was oddly quiet when Jonas said he now understood what pain was. The Giver realized that Jonas only knew discomfort, not pain. Stll, the Giver was able to use the sun to show the difference in pleasure and pain.