When Goku is having a dream during his heart disease, he dreams that Androids 17 & 18 are killing his family. How can he dream them if he's never seen them?
Or maybe he had searched everyone's feelings. Remember when he first met Trunks and didn't flinch when Trunks tried to cut him with his sword? He searched Trunk's feelings and realized that he wouldn't really hit him. So, Goku's laying in bed, doesn't have much to do except wait for the medicine to kick in, so he decides to check up on his friends and see what they know about the androids. I'd say that's a perfectly capable solution.
The problem here is that in the original manga, Goku never had any dream.So that dream was just a filler. The animators at Toei who do the fillers don't re-check the past story line.
Another thing that could have made this happen: If you have seen Bardock Father of Goku, Bardock gets the power to see the future, and for some reason so does baby Goku. Also, on Namek Goku 'Reads Krillun's mind', so who knows?