Here is a pretty detailed, technical discussion of gluing wood. There are two primary mechanisms of adhesion: valence forces, and interlocking action.
Valence forces are forces of attraction produced by the interactions of atoms, ions, and molecules that exist within and at the surfaces of both adhesive and adherend. Interlocking action, also called mechanical bonding, means surfaces are held together by an adhesive that has penetrated the porous surface while it is liquid, then anchored itself during solidification. Here are a couple of key excerpts:
Mechanical interlocking is probably the primary mechanism by which adhesives adhere to porous structures, such as wood. Effective mechanical interlocking takes place when adhesives penetrate beyond the surface debris and damaged fibers into sound wood two to six cells deep. Deeper penetra- tion into the fine microstructure increases the surface area of contact between adhesive and wood for more effective me- chanical interlocking. The most durable structural bonds to wood are believed to develop not only when an adhesive penetrates deeply into cell cavities, but also when an adhe- sive diffuses into cell walls to make molecular-level contact with the hemicellulosics and cellulosics of wood. If an adhe- sive penetrates deeply enough into sound wood and becomes rigid enough upon curing, the strength of the bond can be expected to exceed the strength of the wood.
There's lots more information in the referenced document if this doesn't answer your question.