The first means "What thoughts are going through your head right at this second?" The second means "What is your opinion (on the matter we've been hearing about or discussing)?"
So if there's a particular matter under discussion and you expect someone has or should have an opinion, you ask "What do you think?"
If there's no particular matter under discussion or you suspect someone is still thinking and doesn't have an opinion yet, you could ask "What are you thinking?"