The trees help to hold the soil particles together. When we cut the trees these soil particles become loose, thereby reducing their capacity to hold and absorb water. Thus, whenever there are rains soil erosion and floods take place due to inability of these particles to absorb water.
As for droughts, the trees release oxygen by taking in carbon dioxide. This oxygen cools the region in which there are trees. This is why you may have noticed that forest areas are always cooler than surrounding areas. When these trees are cut down, the place becomes warmer. Thus the water vapour in the air does not condense to form clouds, thereby causing droughts.