After Mr. Whittaker visited his ancestor Albert in medieval England, valuable treasures began to disappear from Lord Darkthorn's collection. If the treasures weren't returned, Albert would be punished and locked in a tower. The Imagination Station would no longer work for Mr. Whittaker because he left a family ring in the past, and the machine thought he was still there.
Since Mr. Whittaker couldn't go himself, cousins Patrick and Beth went on missions to retrieve the treasures and save Albert. Their last trip took them to England where they discovered the real thief and cleared Albert's name. Before Hugh, the thief, could be caught and punished, he stole Mr. Whittaker's ring, which allows him to travel through time in the Imagination Station.
After Hugh escapes in the Imagination Station, Patrick and Beth travel back to Whit's End. Mr. Whittaker works all night and day to program the Imagination Station to track the ring that Hugh is using. When the cousins return to Whit's End the next day, Mr. Whittaker asks Patrick and Beth if they would be willing to follow Hugh in an attempt to recover the ring. They agree, and Mr. Whittaker prepares them to travel to ancient Israel. He gives the children costumes in addition to a harmonica for Beth and a knotted bracelet for Patrick.
The children climb into the Imagination Station and appear in a grove of trees. Beth notices a handkerchief that looks like it's from medieval times. The cousins believe it must belong to Hugh. Suddenly Patrick spots a bear. The bear charges toward them, and they quickly climb a tree. The bear begins to climb after them when a boy with a sling begins hitting the bear with rocks. The bear runs away, and after Beth and Patrick climb down, the boy states that he often has to chase bears away from his sheep.
The shepherd boy introduces himself as David, the son of Jesse. David explains that he is traveling to the Valley of Elah where the Israelite army is encamped against the Philistines. He is bringing food to his three older brothers and the army captains. Patrick and Beth tell him that they are searching for a man named Hugh, who they believe will be with the Philistine army, so David offers to bring them to the valley.
The three children deliver the food, and while they are there, Goliath approaches to challenge the Israelite army. He calls them all cowards and tells them to choose a champion to represent them in single combat. He then curses the Israelite army and the living God. David is outraged at Goliath's curse and asks why no one will fight him. One of David's brothers explains that Goliath is stronger than 10 men, and everyone is afraid to fight him.
David volunteers to fight Goliath, so a soldier takes him to King Saul's tent. King Saul questions David's desire to fight Goliath and states that he needs a man but that God sent him a boy instead. King Saul reluctantly agrees to let David fight, trying to give him armor and weapons. The armor is too big, however, and David is unaccustomed to fighting with a sword, so he decides to take nothing but his sling. Saul tells Patrick to bear a shield for David during the fight and gives Beth a banner with the symbol of David's tribe on it.
Suddenly a guard comes in with a messenger from the Philistines, who just happens to be Hugh. Hugh is surprised to see Patrick and Beth but still delivers his message. He states that if the Israelites don't either surrender or send a warrior to battle Goliath, the Philistines will attack and kill them all. Saul states that David will be their champion. Hugh agrees to carry the message to Goliath, but as he leaves, he does something to the torch in the tent. It explodes in a cloud of smoke, and when the air clears, both Hugh and Beth are gone.
Hugh takes Beth back to the Philistine camp. Beth asks Hugh why he is helping the Philistines since he knows that David will defeat Goliath. Hugh explains that he is helping the Philistines build a catapult, so that after Goliath is defeated they can kill all of the Israelites from a distance.
Meanwhile, back in the Israelite camp Patrick is worried about Beth. Suddenly he hears her playing the Alphabet Song on her harmonica. Patrick realizes she is stopping the tune on different letters in order to send him a message. She is spelling out “catapult.” That night after everyone is asleep Patrick sneaks out of the tent he shares with David and his brothers. He wants to go save Beth and figure out how to stop Hugh from using the catapult.
Patrick arrives at the Philistine camp and begins searching for a tent with guards outside of it, assuming that it will be Beth's tent. He finds her tent and frees her. Beth shows Patrick where the catapult is, and while the two try to come up with a plan to destroy it, David appears. He followed Patrick because he wanted to help rescue Beth. Patrick studies the bracelet Mr. Whittaker gave him and realizes that it is tied with a slipknot. If Patrick can replace the knots that hold the catapult's bucket down with slipknots, the catapult shouldn't be able to fire.
Beth and David cause a distraction to lure the guards away from the catapult, and Patrick begins to retie the ropes. He only has time to do one side of the catapult though before the guards return. Patrick, Beth and David escape and return to the Israelite camp. They rest so they will be prepared for battle.
The next morning Patrick and Beth accompany David toward the valley where he will face Goliath, but eventually David tells them to stay back where it is safer. Goliath issues his challenge again, and David answers it. As Goliath charges toward David, David slings a single stone at him, which kills Goliath instantly.
As soon as Goliath dies, Hugh makes his way toward the catapult and begins to give the Philistines orders to fire on the Israelites. The Philistines launch a large fireball. The knots hold and several Israelite soldiers are badly injured. As the Philistines try to launch a second fireball, however, the slipknot that Patrick tied gives way. The catapult's bucket tips, dumping the fireball out and causing the whole contraption to catch on fire.
Hugh immediately flees, and the cousins follow him in order to stop him from using the ring again. They lose sight of him, but Beth thinks that he probably left the handkerchief that marked his arrival and departure point.
Hugh is still there when they arrive, and they attempt to reason with him. Suddenly the bear returns, and Hugh jumps in the Imagination Station. Beth and Patrick barely make it in before the door closes. When they look around, Hugh is already gone. Only Mr. Whittaker's ring remains.