Well, in some fanfics, he might obtain them through some ancient ninja magic. Maybe he discovers a hidden scroll or a long - lost temple that grants him the power of all doujutsu.
He could also get them as a result of some genetic experimentation. There could be a mad scientist - type character who tries to create the ultimate ninja by giving Naruto all the doujutsu powers. Another possibility is that Naruto is chosen by some divine entity. This entity sees his pure heart and decides to bestow upon him all the doujutsu to help him save the ninja world.
In some fanfic scenarios, Naruto may inherit all the doujutsu through a convoluted family lineage that was previously unknown. It could be that there were hidden branches of his family that had these powers and through some twist of fate, they all come to him. Or perhaps he makes a deal with a powerful spirit that gives him the doujutsu in exchange for a future favor.