Firstly, we know that 12 years prior to the current storyline Shanks:
- Made Foosha Village of East Blue his base for at least a year
- Had the scars on his eyes
- Had obtained the Gomu Gomu Devil Fruit from an enemy pirate
- Was well-known in Grand Line and New World for his duels with Mihawk
My theory states that during one of his adventures Shanks comes across the Gomu Gomu no Mi Devil Fruit and takes it. I’d like to point out that the Gomu Gomu no Mi and the Yami Yami no Mi look very similar in colour and shape. Now Blackbeard in his hunt for the Yami Yami no Mi hears/sees that Shanks obtained the purple devil fruit and mistakes the Gomu Gomu no Mi for the Yami Yami no Mi.
Blackbeard goes and fights Shanks and whether Blackbeard overpowers Shanks or somehow sets a trap is unknown but somehow Blackbeard gave Shanks his scars. During their fight Shanks learns something about Blackbeard or obtains shocking information that makes Shanks question himself and the era. As a result of this he recluses himself to the weakest sea to gather his bearings.
*Theory by Carefulyoi