The sentence is: "Dreams were selected for during evolution to help us survive." When I was translating it, I couldn't understand the use of 'for' here. Would the sentence mean the same without it?
It means "in favor of" in this case. Without it, the sentence would have a different meaning. "Selected for" is a more technical term so it might not have a literal translation into another language. Consider how you might translate something like "large beaks were selected for in these birds" in the sense of "natural selection favored large beaks in these birds" i.e. these birds evolved large beaks. In your example, natural selection favored us having dreams.