Petrified wood is a fossil. It forms when plant material is buried by sediment and protected from decay due to oxygen and organisms. Then, groundwater rich in dissolved solids flows through the sediment, replacing the original plant material with silica, calcite, pyrite, or another inorganic material such as opal. The result is a fossil of the original woody material that often exhibits preserved details of the bark, wood, and cellular structures.
Some specimens of petrified wood are such accurate preservations that people do not realize they are fossils until they pick them up and are shocked by their weight. These specimens with near-perfect preservation are unusual; however, specimens that exhibit clearly recognizable bark and woody structures are very common.[Source]