The topic is so interesting and so much fun - if you love time travel, as many of us do - that I thought I'd provide a more detailed response here.
First, here's a complete statement of the impressively paradoxical Loop: (a) Older Richard has a compass, which he recalls receiving when he was younger, from older Locke (older = Locke has the compass). (Or, we can start when Richard receives the compass from Locke - it doesn't matter where/when in the Loop we start). (b) Older Richard also knows that he must give the compass to younger Locke (or, Locke before he received the compass), and Richard even knows where and when, in the jungle, because older Locke presumably told Richard. (c) Older Richard indeed gives the compass to younger Locke in the jungle last week. Locke has now been transformed to older Locke (with the compass). If he succeeds in giving the compass to younger Richard - which of course he does - the Loop is established.
But - back to the question - where did the compass come from in the first place?
One possible way we can explain how the compass got into the Loop is to hypothesize an earlier version of the universe (Compass 1), in which Richard gets the compass from someone other than Locke. When Richard sees Locke in the jungle last week, he gives Locke the compass, not because Richard remembers actually getting the compass from Locke when Richard was younger, but because Richard sees this as a good plan (including giving Locke the impression that Richard already knew about all of this). The instant Locke takes the compass, we're now in Compass 2, and the Loop (which of course also is predicated on Locke surviving long enough to give the compass back to the younger Richard)...
We can tweak with the details, and say, for example, that younger Richard finds himself in possession of a compass at some point, and doesn't how he came to have it (just as we occasionally all find something in our desks that we may not quite recall receiving). We could also hypothesis that, at some point prior to the meeting in jungle, older Richard suddenly remembers older Locke giving him the compass, etc - just as Desmond does Faraday's visit. But the key in all of these explanations about where the compass comes from - other than the vortex of paradox - is that younger Richard gets the compass, at first, from someone other than older Locke, but quickly knows what he must do and say to younger Locke when they meet in the jungle last week...
Any questions? :)
See also: Lost 5.3: The Loops, the Bomb!
12-min podcast review of Lost 5 Hr 3 - with special time travel loop segment
The Plot to Save Socrates
"a Da Vinci-esque thriller" - New York Daily News
"Sierra Waters is sexy as hell" - curled up with a good book
more about The Plot to Save Socrates...
Read the first chapter of The Plot to Save Socrates .... FREE!