Depending on how the wood was treated, it is perfectly safe to stain it as soon as it is installed or after it has completely dried. Wet-treated wood can take up to 6 months to dry.
Staining pressure-treated wood is safe, but the timing depends on how the wood was treated. There are three types of pressure-treating, wet-treated, treated with water repellent and kiln-dried wood. Kiln-dried wood can be identified by the KDAT or ADAT stamped on the planks. It is best to wait until the wet treated wood is completely dry before staining it. This process can take between 6 weeks to 6 months. It is possible to stain the two latter types of pressure-treated wood as soon as they are installed. However, they take different types of stains too.
Wood that has been treated with a water repellent should only get an oil-based stain. Water-based stains do not soak through the treated surface. Wet-treated and kiln-dried wood can take either an oil-based or a water-based stain. If it is difficult to determine how the wood has been pressure treated, or it is hard to determine the moisture content of the wood, consider using only an oil-based semi-transparent stain.