Jack and Annie visit the tree house and are whisked off to Ancient Japan and the time of the ninjas. They meet some ninjas and must sneak around a samurai.
Back Into the Woods
The Open Book
Flames in the Mist
To the East
Notes on time and place settings
It is mentioned in the book that they landed in Japan during its Period of Isolation, which lasted from 1633-1853.
It is implied that they arrived within a generation prior to their later visit to Japan, Dragon of the Red Dawn, which was certainly in the 1680s.
Ninjas were dying out in the 17th century. The only place where we have evidence of their existence is the countryside of Nagasaki in the late 1630s. In fact, the Samurai seen in the book may have been stationed there because of the Shimibara revolt in 1637.
The river crossed by Jack and Annie could have been the Nakashima river, outside of Nagasaki.