To get Riolu, head to Iron Island and explore the cave alongside Riley. Once you reach the end and defeat the Galactic Grunts, he'll hand you an egg that eventually hatches into Riolu.
If your party is already full, don't worry—Riley will wait right there until you've freed up an empty slot.