In the show they often allude to the history between Guinan and Picard but, to my knowledge, there has never been anything more than allusions.
What exactly happened that created this bond between the two?
Star Trek: The Next Generation - "Time’s Arrow" Parts 2 [Season 6 Episode 1]
1893 - Data followed by Guinan and Samuel Clemens, is able to follow the alien shapeshifters to the same cavern near San Francisco, where they discover that the aliens traveled to the 19th century to take advantage of a cholera outbreak, draining the life force from humans in infected areas to give the impression that their deaths were the result of an epidemic. In an ensuing struggle over a cane-like device used to open the portal, Data's head is severed from his body and Guinan is injured. As Picard tends to Guinan, the rest of the away team, carrying Data's body which continues to grasp the cane device, follow one of the aliens to the future, with Clemens also following them.
The events described above come from Wikipedia and were alluded to by Guinan sometime before in "Booby Trap" [Season 3 Episode 6] when Guinan says, "A bald man was kind to me once, when I was hurting."
According to the episode "best of both worlds" they are beyond friends, beyond family. That would suggest a deep personal involvement, possibly romantic. Or at the very least an extremely close trusted friendship.
TNG Season 2 Episode 1, Wesley Crusher asks Guinan about Picard, and she said that she never met him until she came aboard. This oversight may have been intentional to help develop Guinan's character later in the series.
I suggest that anyone wanting an answer to this question reads the recently published "The Autobiography of Jean-Luc Picard", edited by David Goodman. In this book, although it may not be canonical Star Trek, their friendship begins when, as a member of the crew of USS Stargazer, Picard saves Guinan from bounty hunters
The closest we get to a description of what events actually made them close is in "Engisn Ro", where Guinan tells Ro that when she was in trouble, Picard helped her. But presumably there was a lot more than that over a long friendship.
There are no other details given. The events depicted in "Time's Arrow" don't shed much light on their relationship, it's just Picard insisting that yes, they really will be super close in the future.
Guinan once said that she's attracted to bald men because one helped her when she was hurt, most likely Picard, and the first incident (probably one among many) was portrayed in Time's Arrow part 2.
Some of their relationship is posted in various novels, but they're not considered canon.
Although "Star Trek: Generations" wasn't released until two years after "Time's Arrow" in Season 6 of TNG, the events in "Generations" seem like they would have provided the first opportunity for Guinan to meet Picard. Of course, none of this would have been known to the writers during TNG season 6 or before, so it wouldn't explain the dialog. But Guinan could have been worked in to "Generations" in order to tie up that story line, no?
On second thought, no. The Picard that meets the "Nexus Guinan" has already got his own Guinan by that time. Oh, well, it was worth a shot.
I too have seen every TNG episode countless times, I'd guess at least 10 times each over the years. I'm 99.9% sure there is no explanation in the show or films that really answers to this. It's simply alluded that they are very very close but other than that never tell us why or when. While Guinan does make several comments about bald men, saying she's attracted to them I've never gotten the impression they were romantically involved in any way. To me it's got to be a far deeper relationship than a romantic one, how many people would describe or act the way they do around an ex-lover. Sure that's not 100% proof but the various comments they both make throughout the series and movies not once did I ever get any kind of thought or implication that they were romantic. Clearly TNG isn't scared of showing that side of Picard, while he was no Kirk or even Riker the relationship between Picard and Beverly Crusher is explored many times with them being married (and divorced or separated) in the future he experiences thanks to Q in the series finale. I do wish somewhere it would have been explained in some level of detail as when I rewatch the episodes and hear those comments I think "yeah yeah, whatever, sure you did" since we really know nothing of that history.
From "Time's Arrow, Part 2"
Picard: I didn't want anything to happen to you you're far too important to me.
Guinan: you know an awful lot about me.
Picard: believe me in the future the tables will be turned.
Guinan: do we become friends.
Picard: oh it goes far beyond friendship.
This implies either a romantic or familial relationship.
I just read this short article about Guinan being in the upcoming series.
The story behind this statement needs below some research. I can't find anything additional about it.
Later, she also revealed that Guinan and Captain Picard (Patrick Stewart) were so close because he was actually her descendant.