It's that time. You need to stain a deck, fence, or whatever it may be. Whether it's your annual coat or something more frequent (you overachiever), the question has probably dawned on you:
Can you stain wood if it's wet? 
The answer is yeah, you can, but it won't work well unless under the right conditions with the right supplies. The general rule of thumb is to wait 48 hours after exposure to moisture, if the wood is left in direct sunlight, but that could very well increase to 72 hours if the wood is in the shade.
There's a bit of reasoning behind that answer.

How Wood Changes With Water And How It Affect Staining

The structure of wood physically changes when it is exposed to water. Because it's hygroscopic, it contains large numbers of cells that absorb water, causing its structure to grow denser, heavier, and expand larger. 
Hygroscopic cells clump together in groups of vertical tunnels, kind of like pipes to bring water through the structure. While the cell wall contains a small bit of water, the inner tube can hold and release moisture. The point of these pipes is to bring water up from the roots of the tree to other parts. 
The wood will become soft and flexible, as opposed to hard and brittle. The swelling of wood will be affected by species, structure, density, drying conditions, etc. It'll even be affected by the temperature of the water, according to three scientists.
According to their 1994 paper in Wood Science and Technology, "Raising the water temperature above room temperature significantly increased the rate of swelling of wood. Also, an increase in water temperature caused an increase in the maximum equilibrium swelling of wood."
As these are affected, the wood will warp and change shape. As cells take in water and change their rate of absorption, this will affect the ultimate application of wood stain. 

How Wood Accepts Stain

Briefly summarized: stain is a colorant (pigment or dye) suspended in a liquid (solvent), and if it's a pigment it'll need a glue to hold the color to the wood (binder). Pigment will lodge in large pores or sanding scratches, but to actually be held in place, it'll need that binder. Dyes are a much finer substance. They often don't need a binder.
The process of staining wood includes uniform application of a stain to its surface. Once the stain is brushed or otherwise coated on the porous surface, it slowly seeps inside. If it's a pigment, it will adhere within those pores with the help of a binder. If it's a dye, it'll sink deep into the wood and bind to it. 
The solvent evaporates in either case, and the colorant is left behind. In the case of the pigment, the wood will have an additional, resinous glue within its pores, causing subsequent stain jobs to be less effective unless the wood is treated appropriately.
Different types of wood will accept stains in unique ways. This all gets back to the size, shape, and placement of their pores. 
For example, pines have smaller pores. That's because they're a softwood with closed grain, or small pores. 
Oaks will often have thicker, broader pores. That's because they're a hardwood with Ring Porous, or large pores. 

How Wood Reacts To Stain When Wet

At this point, it's fairly clear what happens when wood is wet. The pores lose their structural ability to adequately accept a stain evenly across the surface. 
The rate of evaporation is another important issue to keep in mind during your waiting game for the wood to try. If some parts of the structure are under direct sunlight, they'll dry thoroughly and in a timely manner. However, if some parts of the structure are under variable shade, then drying will be inconsistent. The stain will absorb unevenly and the end product will be blotchy.
There's nothing worse than a blotchy deck. OK, fine, there are some things that are worse than a blotchy deck, but they're few and far between as far as we're concerned. 
There's a common approach of wetting the wood before staining. This is called "popping the grain" or "water popping." The method will raise the wood fibers (once dried) so that the stain can be applied evenly across the surface with a beautiful, professional finish. 
Regardless, when you're applying your stain or oil, the rule of thumb is to let it dry before you apply.