In Apollo 11, 12 ,14, 15, 16 and 17 there were three crew members in each mission and only two men made a lunar walk. If that's true then what could be the reasons for not permitting the third member (the most unfortunate) to come out of the module?

Is it not the most unfortunate fate that can fall on a person who travels to the moon and doesn't get a chance to walk on its surface?

What happened in Apollo missions is that once they were in orbit around the Moon, the Lunar Module separated from the Command Module and descended to the surface. This meant that the mass of the lander was much lower, which saved tremendously on the size of rocket needed to launch the whole thing from Earth. Every kilogram they wanted to land on the Moon required something like 25 kg of rocket to launch it from Earth. It was most efficient to land only part of the spacecraft that reached the Moon on the surface. The rest stayed in orbit, with the heavy fuel, engines, heat shield, and life support systems needed to return home.

There were a few reasons to leave one person aboard the Command Module. First, that person was very busy the whole time conducting observations and collecting data for science objectives that could only be done from orbit - they had a great view of the Moon. In this What If article, there are a couple of great quotes about what that was like for them.

Second, that person was there in case there were problems. There are a few limited situations where they could have rendered assistance if the Lunar Module had trouble docking with the Command Module upon return. More to the point, if the astronauts that landed could not return and were stranded on the Moon, still the Command Module could make it back to Earth, and the mission would at least have some success.