That's always been a bit fuzzy. Cos it was a Time War, there was an implication that Gallifrey's destruction (as far as everyone was concerned) meant it no longer existed at any point in time. But if that was the case, then the Doctor shouldn't really be around either. Then RTD created the whole 'Time Lock' thing for The End of Time, and then we discover it wasn't destroyed by the Moment by Captain Grumpy anyway and is sent to a pocket universe - where time apparently can still pass, hence the Time Lord's message on Trenzalore and subsequent gift to the Doctor through the crack.
The way I see it, the Doc could always have travelled back to Gallifrey in its past (even before he discovered/remembered what had really happened), but chose not to as it would have been too dangerous, both to his own time-line and to Gallifrey's in general - Not to mention, pretty traumatic and upsetting. After all, even when Gallifrey was around in the classic series, all of the Doc's visits were always chronological. Presumably it's the one place in the universe where he can't/won't visit the past.