Why they needed gold isn't really explicitly explained in the film, but in an interview, director Jon Favreau said:
Is there a backstory to why they want gold?
If you look at the mythology of aliens, there's a lot about gold. It's about them coming for gold; whether that's a simplification or not. If you think of Chariot of the Gods, there's this reoccurring theme of gold. If you also say in addition to no faster-than-light travel, that nobody's created transmutation, gold is created in very trace amounts in supernova, so it would be very rare anywhere and rarity would lead to value. It's also a useful, malleable, ductile material that might be used by higher order of technology and if we ever go anyplace else, it would be like Outland. We'd be belters, we'd be mining for resources from other places. So, they would probably have the same logic. Also, most importantly, if works very well for the metaphor of The Treasure of the Sierra Madre and the gold. It's the intersection of where those two things lie and we address it pretty square on. It's either going to be there's here to eat us, which seems silly to me. It's the best choice of all the choices and the one I felt was the most poetic. And then to study us, to get into the whole vivisection mythology of aliens as well, we wanted to encapsulate as many of the images of what people think the aliens do when they're here and then, also, to make it a bit horrific.