The explanation I've heard in a few places was that Prowse was joking/speculating at the time, and only happened to be right. I've seen a few people speculate that he must have seen an early script or draft and ran with that.
While this interview from 2006 does not specifically address the supposed leak, he does say that he didn't know the truth, and that he felt the studio didn't trust him because he might leak something like that.
So they never told you?
I finished the film in November 1976 and when it came out in the USA in May 1977 I got a note from director Russ Meyer saying ‘congratulations Dave, you’re in the biggest movie ever. By the way, did you know they overdubbed your voice?’ I have never spoken with George Lucas since 1983 and neither he or anyone from Lucasfilm has ever come to me saying why they overdubbed my voice.
In the Empire Strikes Back you also didn’t know the line ‘no Luke, I am your father’ was going to be in the movie. You said ‘No Luke, Obi-Wan is your father’.
No, I never said that. I just said ‘come and join me and the Dark Side’. I had no dialogue referring to Luke’s father. I have never seen a script for the Empire Strikes Back or Return of the Jedi. Everything was kept a secret because they were afraid things would leak. I think only George, Gary Kurtz and Mark Hamill knew.
What do you think about the fact that Darth Vader is Luke’s father?
I think it’s a wonderful twist.
And what about the fact that they didn’t tell you?
I think it’s a lack of trust. They were afraid I was going to say something in an interview. While if you’re one of the main characters the last thing you would do is give such information away. I was very careful so I hated the lack of trust.
Additionally, according to this article, Prowse's own book states that he only learned about the twist at the premiere of the movie. He repeats this in this interview/article
That was not the only time he was kept in the dark.
David had no idea he would be revealed as the father of hero Luke Skywalker in the second film, The Empire Strikes Back, until he saw it on the big screen.
Security was tight around the scripts after information leaked out early in filming and Lucas may have wanted to keep the film's big twist closely guarded.
"They must have given me some completely different line, because it was all going to be overdubbed," David said.
"When I went to see the movie I suddenly discovered I was Luke's father.
"That's my favourite scene of all."
In the Annotated Screenplays, Irvin Kirshner, the director of The Empire Strikes Back also explicitly says that Prowse did not know, and that Hamill was the only one who did.
The actor who played Vader did not know that Luke was his son; when we did the scene, the only one who knew was Mark, and I told him right before we shot it. We didn't want anybody to know, so i had the page with the real dialogue put away. So the actor playing Vader was saying other words; I gave him other words. He was saying something totally different, which of course we replaced later.