"We didn't talk for a long time." (simple past tense) You might say this when you are describing a past situation that has ended, since you are talking with that person again. It could be that you and your best friend had a fight and refused to talk with each other. But now you both have made up and are talking to each other again.
"We haven't talked for a long time." (present perfect tense) You didn't have a fight or anything like that with your best friend. Maybe you've both been really busy and that's why you haven't seen or talked to each other for awhile.