It appears as if the children were telling Elisha to get out of here and mocking him so God allowed 2 bears to go against them because they disrespected the man of God.
2Ki 2:24 And he turned back, and looked on them, and cursed them in the name of the LORD. And there came forth two she bears out of the wood, and tare forty and two children of them.
Lev 26:22 I will also send wild beasts among you, which shall rob you of your children, and destroy your cattle, and make you few in number; and your high ways shall be desolate.
Israel was rebellious at this time and Elijah and Elisha worked to bring them back to the truth.
This was one of the punishments that God would cause to come upon Israel if she continued in her disobedience.
The children would of had to learn by their parents to be against the man of God which their parents would of had to be rebellious against the truth.
They were either saying go thou up because they heard Elijah went up and they wanted Elisha to leave as well, or was saying get out of here for we want nothing to do with you.
No person witnessed that Elijah went up but Elisha for if they had witnessed it then it would seem like that would of caused them to start going back on track to be right with God.
But they could of heard about it but did not believe it so they were mocking him concerning that which would be a better reason for punishment than if they were only mocking him because he was bald.
Or they could of been saying get out of here for we want nothing to do with you.
Either way they mocked him and wanted nothing to do with him and did not respect that he was a man of God so they received the punishment as recorded in Leviticus that wild beasts would go against their children.
For if the bears attacking the children had nothing to do with mocking Elisha it probably would of not been recorded.
It seems like the 2 bears was a punishment upon the children for the bears came out of the wood so the children were not in the woods disturbing them.