Matt. 19:26 Jesus looked at them and said, "With man this is impossible, but with God all things are possible."
Mark 9:29 He replied, "This kind can come out only by prayer and fasting."
If all things are possible with God, then what's all this about the need for prayer and fasting?
Textual criticism suggests that "and fasting" is not part of the original text (Witherington commentary on Mark, 268).
That leaves prayer -- and prayer of course is communion with God, so that it fits right in with prayer being required for the spirit to come out. In other words, this says nothing in terms of something not being "possible" for God. (For more on understanding this passage, see here.)