1) if it's softwood, discard it. Softwood does poorly in an aquarium
2) if it's hardwood, give it a good thorough scrub with a stiff brush, then give it numerous soakings in boiling hot water. Boiling hot water and long soakings will help terminate potential bio in the wood as well as open pores to leech tannins. Optimally, the water will drain nearly clear before it goes into the aquarium. Most pieces will continue to leech at least a little for many days, but some people get pieces that leech for months. (I've heard a few that did so for years.) If you like that look (which I actually like a lot) then you won't mind.
3) soakings will also help water log the wood for easier placement in the tank. I've soaked pieces for a couple weeks to get them heavy.
4) if you don't know ANYTHING about the wood's history AND you don't like risking the fish in your tank suddenly dying, I'd put the wood in a large bucket with an aerator and a couple guppies or tetras. If they die, it has toxins (probably pesticides.)
Of course, many people do successfully grab random pieces, toss them in a tank and report no issues. On the other hand, that's not always true.