In plants, the gas exchange occurs by diffusion through the cuticle, the stomata and the lenticels. In the leaves of plants there are small pores, the stomata, which can be opened and closed by the guard cells on each side of the pore. In regions where gas flow needs to be relatively high the diffusion process occurs via intercellular air spaces. Because the cells of plants are often slightly irregular, when they are packed together small intercellular spaces are left. These spaces may if large enough become filled with gases and allow for the rapid diffusion of gases to and from the cells and the atmosphere. The spongy mesophyll layer of the plant leaf is a good example. The irregular cells form large air spaces so that gases can move quickly and easily into and out of the palisade mesophyll cells which are photosynthesising in daylight. You should remember that plants are respiring at all times but only photosynthesising at night and therefore their will be a net inflow of CO2 and an outflow of O2 during the day, while the flow is reversed at night. At dawn and dusk when the photosynthetic rate exactly matches the respiratory rate there will be no net intake or loss of gases, this is the so-called compensation point.
In the roots of the plant, there is no photosynthesis occurring so there is always a flow of O2 into the root by diffusion and an outflow of CO2. The root is dependent upon the diffusion of oxygen from the interstitial spaces of the soil and this is why aeration of the soil is important for the healthy growth of plant. Plants which inhabit marshes and bogs have the special problem that there is almost no oxygen in the mud through which the roots are growing. Most plants would drown under these conditions but the bog plants have evolved special mechanisms to allow oxygen to diffuse into the roots from the stems where oxygen is produced by photosynthesis.
In stems of woody plants which have a non-permeable cork bark, there are special openings called lenticels, you may have noticed these as small dark spots on the newer stems of bushes and trees. The lenticel is an area where the cork cambium, which produces the cork impregnated cells of the bark, is disrupted slightly so that instead of producing tightly packed layers of cells they will produce loosely packed irregular shaped cells with air channels passing between them. This allows gases to diffuse into and out of the otherwise impermeable stems.