I read in one book that the Jedi hid a powerful Sith weapon powered by the dark side on Dagobah in the cave. Yoda the last of the Jedi counsel made Dagobah his home to keep watch over the weapon so that it wouldn't fall back into their hands. This explains why the cave was strong with the dark side, but it wasn't explained in the films.
The main plot of that film was that Luke could not alter his fate. He was destined to confront Darth Vader. Yoda keeps telling him to keep his mind focused on training, and not to worry about his friends. Which ultimately is his weakness and results in him meeting Darth Vader.
Yoda's fear is that Luke will not survive a confrontation with Darth Vader, but Yoda fails or underestimates the value of Luke's friends to save him from his fate. The goal of Yoda's training is to teach Luke that he is not ready to meet his fate.
Despite Yoda's teachings Luke doesn't seem to be afraid of his fate. Thus the phrase from Yoda "you will be". It's just another example of how Yoda is aware of Luke's fate, and Luke is ignorant of the risks.
When Luke enters the cave he sees Darth Vader. He is confronted by his fate, and when Luke strikes down Vader to reveal his own face in the mask. It demonstrates that Luke's self-confidence in his skills to beat Darth Vader will ultimately result in his death.
The idea is simple. If he fights Vader he will die, if he takes a path that leads to the dark side he will die. Staying with Yoda and finishing his training will delay his fate.
Yoda was trying to teach Luke a lesson. Luke needed to stay and complete his training. Yoda knew Luke was destine to face Darth Vader and that confrontation would kill him, because Luke wasn't ready (or worse he would turn to the dark side). Yoda was trying to protect Luke from his own fate, but at the same time understood he could do little to change his fate.
When Luke has Yoda raise his x-wing out of the swamp onto dry land, then this marks the point were Yoda gives in. He no longer seems able to steer Luke away from his fate, and Yoda dies. Yoda's death represents Luke's commitment to his fate. He can no longer continue his training. He has no choice but to face Darth Vader.
At this point. He sets on a path to full fill the vision in the cave. Face Darth Vader and die. At least, by a movie viewer's perspective at this stage in the film. That's the expected outcome, but his friends save him in the end and we learn why his fate is so closely connected to Vader.