This is only answered in the (unfortunately) non-canonical novel, Thanos: Titan Consumed. The summary of events is in this Screen Rant article.
Thanos, after realising that attacking individual worlds was too slow he begins searching for Infinity Stones again:
This quest took Thanos to a doomed system that had been obliterated millennia ago, where he sought the advice of the Lorespeaker. It's analogous to a similar scene in the comics, where Thanos gained cosmic knowledge as he gazed into the Infinity Well. And it's here the Mind Stone's origin is revealed.
The Mind Stone had been with the Lorespeaker for millennia and it was inside the Scepter when Thanos happens across him. Thanos is actually overpowered by the Lorespeaker but saved by Nebula and Gamora who kill him. When leaving Thanos takes the Scepter, containing the Mind Stone with him as well as the Lorespeaker's head.
“What about this thing?” Gamora asked, pointing to the Scepter. It had landed close to the Lorespeaker’s body.
“Don’t touch it,” Thanos ordered. Gamora hesitated just an instant, then backed away.
Lips pursed in concentration, Thanos crouched by the Infinity Stone. The blue stone glimmered. He half expected a shock when he touched the Scepter, but he felt nothing more than smooth alloy. He picked it up in one hand.
Thanos: Titan Consumed
From here he acquires the Mind Stone, and begins his journey to acquiring them all.