The forming of opal is a completely natural, yet lengthy process.
The substance itself is actually a solution of water and silicon dioxide. That silica is transported and picked up from sandstone via the water, which then carries it into all sorts of voids and cracks. These cracks are often decomposing fossils, or sometimes just natural faults.
The water that carries these silica elements eventually evaporates, and leaves all the silica behind. In this case, wood can start a petrifaction process underneath the ground.