Mesoporous materials, such as porous silicon and porous polymer gratings (Bragg structures), offer an attractive platform for the encapsulation of chemical and biological recognition elements. These materials include the advantages of high surface to volume ratio, biocompatibility, functionality with various recognition elements, and the ability to modify the material surface/volume properties and porosity. Two porous structures were used for chemical and biological sensing: porous silicon and porous polymer photonic bandgap structures. Specifically, a new dry etching manufacturing technique employing xenon difluoride (XeF2) based etching was used to produce porous silicon Porous silicon continues to be extensively researched for various optical and electronic devices and applications in chemical and biological sensing are abundant. The dry etching technique to manufacture porous silicon offers a simple and efficient alternative to the traditional wet electrochemical etching using hydrofluoric acid. This new porous silicon material was characterized for its pore size and morphology using top and cross-sectional views from scanning electron microscopy. Its optical properties were determined by angular dependence of reflectance measurements. A new class of holographically ordered porous polymer gratings that are an extension of holographic polymer dispersed liquid crystal (H-PDLC) structures. As an alternative structure and fabrication process, porous polymer gratings that include a volatile solvent as the phase separation fluid was fabricated. Porous silicon and porous polymer materials were used as substrates to encapsulate gaseous oxygen (O2) responsive luminophores in their nanostructured pores. These substrate materials behave as optical interference filters that allow efficient and selective detection of the wavelengths of interest in optical sensors.