An oasis is a place where water comes to the surface in a dry region. This water is ground water. It is seeping out of the rocks. The water probably got into the rocks as rain falling on distant mountains, and has then seeped though the rocks until it is in a desert area. If the level of water in these rocks is high enough, it will then seep out and make a pool of water.
Because oases are supplied with water from far away, they do not depend on local rainfall. In a desert, the water hole is often surrounded by plants, and in particular palm trees, whose long roots can search deep into the ground for water.