The idiom, 'The pen is mightier than the sword' was coined for the play Richelieu; Or the Conspiracy by Edward Bulwer-Lytton in 1939.
This is one of the favorite idioms used by those who believe in using peaceful methods of attaining their goals as opposed to violence. The ability to communicate thoughts effectively to others is a far more effective way to achieve results than those possible with the use of violence and the waging of wars.
A classic example of the use of this phrase would be in the context of the completely non-violent movement to free India from the rule of the British that was started by Mahatma Gandhi. He inspired millions of common Indians to oppose the British in a peaceful manner. They were to boycott British products, not work for British factories, and demand their rights, but without the use of any violence. The result of this was the British being forced to give freedom to India after several centuries of colonization.
This quote is the reason why we have freedom of the press. It is saying that words (the pen) are more important than weapons (the sword) in creating changes in the world.
To understand why this is, just look at what has happened in Egypt lately. There, words have proven to be much more important than weapons. We have seen protestors come together, drawn by "the pen." They have been drawn together by word of mouth, by social networking, and by the media. They have been drawn together because they believe in an idea--the idea of freedom. All of these are things of "the pen."
Against them, you had the Mubarak government. The government had all the power--they had the tanks and the guns and the protestors did not. But the power of ideas overcame the power of the weapons and the side with all the weapons ended up losing.
So, when you hear that the pen is mightier than the sword, it means that words and ideas are more important than force--more able to change the world.