Shakespeare, speaking through King Lear, is using poetic license here. It is common knowledge that every baby cries as soon as it emerges from its mother's womb. If it doesn't cry of its own volition it will be given a sound slap on the behind to make it cry. This is supposedly necessary to start the lungs working and to clear the respiratory passages. Lear pretends that babies all cry at birth because they realize they have been brought into a terrible world. He has already described to Gloucester some of the human behavior he deplores, beginning with:
A man may see how this world goes with no eyes. Look with thine ears: see how yond justice rails upon yond simple thief. Hark, in thine ear: change places, and handy-dandy, which is the justice, which is the thief?
Lear continues for many lines giving illustrations of the wickedness and duplicity of humanity. One striking example is:
The usurer hangs the cozener.
A cozener is what we would nowadays call a con-man, a swindler. A usurer may charge exorbitant interest and add penalties for late payments and be considered respectable and law-abiding.
When Lear uses the metaphor "this great stage of fools" he is talking about all the people in the entire world. He has developed a very negative world view as a result of his experiences with his two thankless, selfish and deceitful daughters. When a bit earlier Gloucester says, "O, let me kiss that hand!" Lear says, "Let me wipe it first; it smells of mortality."
This is not the only play in which Shakespeare compares the entire world to a stage. In As You Like It, Jacques has a long monlogue in which he begins with the lines:
All the world's a stage
And all the men and women merely players
When Lear calls the world a great stage of fools, he does not mean that all men and women behave like jesters but that their behavior is pointless, stupid, idiotic. They attach great importance to their own motives and activities without understanding that life is really meaningless. And the baby who cries right after it is born seems to realize that it too will grow up to be as foolish as all the other people.
In Act 3, Scene 1 of Measure for Measure, Duke Vincentio expresses Shakespeare's characteristically negative opinion of people and of life in a speech beginning with:
Reason thus with life:
If I do lose thee, I do lose a thing
That none but fools would keep: a breath thou art,
Servile to all the skyey influences,
That dost this habitation, where thou keep'st,
Hourly afflict: merely, thou art death's fool;
For him thou labour'st by thy flight to shun
And yet runn'st toward him still.
Hamlet expresses similar opinions about humanity. Here is a beautiful metaphor from that play:
O God! God!
How weary, stale, flat and unprofitable,
Seem to me all the uses of this world!
Fie on't! ah fie! 'tis an unweeded garden,
That grows to seed; things rank and gross in nature
Possess it merely.
And Shakespeare uses the image of a stage again in Act 5, Scene 5 of Macbeth when his protagonist says:
To-morrow, and to-morrow, and to-morrow,
Creeps in this petty pace from day to day
To the last syllable of recorded time,
And all our yesterdays have lighted fools
The way to dusty death. Out, out, brief candle!
Life's but a walking shadow, a poor player
That struts and frets his hour upon the stage
And then is heard no more: it is a tale
Told by an idiot, full of sound and fury,
It seems appropriate that a playwright should regard the entire world as a stage.