You do not have to use the in the sentence but you can if you like. The difference between the two sentences is that when you say "the" machines it is talking about specific machines. It is saying that people always imagine the future to have the machines ( meaning the certain machines that are magically helpful. This counts only the machines that are magically helpful and no other machines.)
When saying, "people always imagine the future to have machines that are magically helpful" it is not talking about specific machines. It just saying people imagine that in the future there will be machines that are magically helpful.