There’s still nothing known how and when exactly she ate the Hana Hana no Mi.
How Did Nico Robin Obtain Her Devil Fruit Powers?
That’s a frequently asked question.
She must have ate it at or before she was 8 years old as we saw her using it and she had been ostracized by the citizens of Ohara for being a freak and a monster.
We know that when a Devil Fruit user dies, its ability is reborn into a new Devil Fruit in a random part of the world.

The ability simply regenerates inside another similar fruit, which then transforms into said Devil Fruit.
It’s possible that it was reborn in a random fruit on the sea and it washed ashore and Robin found it, considering she does walk on the beach, that’s how she met Saul.
She could”ve found it in the big forest which she apparently also wandered often into.

She might have eaten it by accident and/or because she was hungry.
She could’ve also did a Luffy and swiped it from the Archaeologist who did frequently travel outside of Ohara and could’ve brought it back with them.
Who knows, Oda never revealed this bit of information, maybe it will be touched upon in the future, maybe not.
