Why does Shanks already have his scar at the beginning of One Piece? In this image of Shanks from Luffy's hometown, Luffy was still quite young.

However, it is said that he got his scar from Blackbeard. Did he get his scar when Blackbeard was still a part of Whitebeard's crew? Because I think that when he got this scar, Ace was already after Blackbeard and the commander of 2nd division, but at this time, Ace and Luffy were still young.
The story of the origin of the particular scar (left eye) is told in Chapter 434 / Episode 316. It's given to him by Blackbeard while still on Whitebeard's ship, as part of their crew. By the time Ace and Luffy have grown up, Shanks is one of the Emperors.


  The conversation hits a more serious note as Shanks points to his scarred left eye. One of Whitebeard's crew gave it to him, Marshall D. Teach. Shanks has known what Teach has been up to all these years and tries to warn Whitebeard of what may happen if Ace and Teach meet, he begs Whitebeard to stop the search. When Whitebeard outright refuses and states he will teach Teach about morals, Shanks reacts by drawing his sword, stating the rampaging era will not be stopped. Whitebeard and Shanks clash weapons, splitting the skies to the shock of both captains' crew members. 


Source: http://onepiece.wikia.com/wiki/Chapter_434