Depends on strain and the wood. I've known nana petite to take about 3 months where as a. barteri to attach in around 3 weeks. How it does this I can't tell but I'd assume it's by using short roots like ivy?
If you look closely at the long roots of an 'unattached' anubias you will notice lots of little nodules which are 'hooklike' in appearance. I would gues under a microscope there would be loads of tiny little 'hooks' much like moss.
I attached an anubia plant (which one, embarassingly, I don't know...) to a porous rock and then dismantled the tank about 2 months later. When I took the anubia out it had secured itself pretty well to the rock, and I had to pull at it quite a lot to get it to let go.
From my experience, (and now I think about it, it's pretty damn obvious), they seem to attach much better to things with lots of holes.