So, in those cases, the tree had stood dead for some time. The typical height of upright fossils is on the order of two meters, so many of these fossils represent only the base of the original tree. The top of the tree presumably rotted. To tell this, geologists look at the material surrounding the fossil. It is possible the material is a sandstone made of wind-deposited sand.
Some sandstones are essentially fossilized sand dunes.
We know that in the modern world, sand dunes move fairly quickly. For example, the Sleeping Bear Sand Dunes, on the eastern shore of Lake Michigan, have been known to cover trees ten meters high in just a few years. It is much commoner for these fossils to be buried by volcanic ash, or by a debris flow caused by an eruption. As Mt. St. Helens and Mt. Pinatubo showed, a single eruption is all that's needed, and even an intense pyroclastic flow does not flatten all of the trees. The Tertiary Period fossil forests in Yellowstone National Park , USA are of the volcanically-buried type.