Perhaps the most important verse in this brief exchange is the following verse,(vs 50)
And Jesus said unto him, Forbid him not: for he that is not against us
is for us.
It's apparent that this individual saw Jesus cast out demons, and saw the disciples cast out demons; what he did not see was the Scribes and Pharisees cast out demons. The key passage to understand who can cast out demons is found in Matt. 11:24-30,"
But when the Pharisees heard it, they said, This fellow doth not cast
out devils, but by Beelzebub the prince of the devils.
And Jesus knew their thoughts, and said unto them, Every kingdom
divided against itself is brought to desolation; and every city or
house divided against itself shall not stand:
And if Satan cast out Satan, he is divided against himself; how
shall then his kingdom stand?
And if I by Beelzebub cast out devils, by whom do your children
cast them out? therefore they shall be your judges.
But if I cast out devils by the Spirit of God, then the kingdom of
God is come unto you. Or else how can one enter into a strong man's house, and spoil
his goods, except he first bind the strong man? and then he will spoil his
house. He that is not with me is against me; and he that gathereth not
with me scattereth abroad.
The key to understanding this passage is vs 27,
And if I by Beelzebub cast out devils, by whom do your children cast
them out? therefore they shall be your judges.
Jesus is throwing their charge of "...he casts out demons by the Prince of demons" back in their face; He is saying, 'Ok, if I follow your argument of casting out demons by the Prince of demons, by what name are you or your followers casting demons by? They will tell you if you are right or not.'
The Truth of the Matter is they did not cast out demons, neither they nor their followers. And then to show them exactly who it was that demons were cast out by, He says,(vs 28)
But if I cast out devils by the Spirit of God, then the kingdom of God
is come unto you.
The conclusion is therefore, whoever would cast out demons does so by the Spirit of God, this is the ministry of the Kingdom of God that Jesus and His disciples revealed.
The following verse reveals the instance of the man the disciples were trying to restrain from casting out demons,(vs 30}
"He that is not with me is against me; and he that gathereth not with
me scattereth abroad."
The Scribes and Pharisees who not with Him and were against Him were "scattering abroad". The man that was casting out demons in Jesus's name was "with Him and gathering". Hence, Jesus could say about him,(Mk. 9:39-40}
But Jesus said, Forbid him not: for there is no man which shall do a
miracle in my name, that can lightly speak evil of me.
40 For he that is not against us is on our part.
Although he didn't "follow Jesus" the same way His disciples did, he was "for Him" and obviously casting out demons in Jesus's name through the power of the Holy Spirit. To this Jesus's message was "Forbid him not".