The sentence you wrote is mostly correct but can be improved a little for clarity and grammar. Here's a corrected version:
Original: Wind picks up sand and carries it to new places. When it falls, it piles up to make sand hills called dunes and barchans.
Corrected: Wind picks up sand and carries it to new places. When the sand falls, it piles up to make sand hills called dunes and barchans.
Explanation: In the second sentence, "it" should refer clearly to "sand" rather than the wind. So saying "When the sand falls" makes the meaning clearer.