Question: Sometimes when I read I notice that some authors say **"the first time"** while others say **"for the first time"**. Of course mostly in different situations but is there a difference? What does the preposition change?

1. I have done it the first time in my life.
2. I have done it for the first time in my life.

Or

1. That's the first time I've heard this song.
2. For the first time in my life I have heard this song.

Or

1. It will be the first time when I am going there.
2. It will be for the first time when I am going there.

Edit: The sentences (examples) aren't from books.

Answer: 
You cannot use the present perfect with a time phrase that excludes the present, which *the first time* does, unlike *for the first time*.

"The first time" requires the past tense.

> 
> I drove a car the first time at age 16. 
> 
> 
> I drove a car for the first time at age 16.
> 
> 
> WooHoo! I have driven a car for the first time!
> 
> 
> WooHoo! I have driven a car the first time! ungrammatical
> 
> 
> 

P.S. **the first time** refers to the first *of several* or of many, whereas **for the first time** refers to the first *as first*, as something *new*.

> 
> The first time I read that poem, it made little sense to me, but after rereading it several times, it began to make sense to me.
> 
> 
> I had never understood the poem, but after my strange experience in the noonday sun, it made sense to me for the first time.
> 
> 
> For the first time, I understand what you were going through.
> 
> 
> The first time, I understand what you were going through. ungrammatical
> 
> 
>
This question has confused me for a long time. In my opinion (I am not a native speaker of English):

**the first time** can be used as conjunction, while **for the first time** can only be used as adverse:

> 
> The first time *I saw him*, he was wearing a black coat.
> 
> 
> For the first time I *saw* him wearing a black coat.
> 
> 
> 

Also, **the first time** emphasizes "time point", while **for the first time** emphasizes "time line" (from past to the time the incidence happened). When we put "for the first time" inside a "when clause", it enphasizes "time point" as well, for example:

> 
> The first I saw him, he was wearing a black coat. (time point)
> 
> 
> For the first time, I saw him wearing a black coat. (time line) 
> 
> 
> When I saw him for the first time, he was wearing a black coat. (time point again)
> 
> 
>