There are two parts to this story. The first part is about Bhishma's parents. River goddess Ganga and Father Shanthanu, the king of Hastinapura.
Second part is the story behind Bhishma's birth. So we will go one by one.
1. Ganga and Shantanu:
In the previous birth, Shantanu was a king of one of the most powerful dynasties ikshvaku and he was called as Mahabhisha. He was once invited to Lord Brahma's court post his death. While he was sitting along with others on the court the beautiful daughter Brahma, Ganga sat opposite to him. And suddenly a strong wind blew and due to that the top portion of the saree, worn by Ganga, got displaced. Everybody in the court got vigilant of the incident and put their heads down except Mahabhisha. He kept gazing at her body and Ganga as well encouraged it since she found him attractive.
Looking at this incident, Lord Brahma became furious and he cursed Ganga to be born as a human on the earth and Mahabhisha as Shantanu. He further cursed Shantanu that he would strive, long and crave for Ganga after she left him. Mahabhisha and Ganga were taken back hearing the curse. They never saw that coming. Later, Bhishma was born to them.This was the story of Bhishma's parents
2. Bhishma's birth secret.
In Hinduism, it is said that there were eight attendant deities to Indira and Lord Maha Vishnu and they were called Ashta Vasus. Those Ashta Vasus were once lingering around with their wives on the land of Sage Vasisht. One of the Vasu was astonished to look at the Cow named Nandhini, it was too beautiful to see. He showed the cow to his wife, and his wife wanted it home. He tried pacifying her saying it belonged to Sage Vasisht. She had no ears for him. Due to her coercion, he rode the Nandhini cow with him.
This action exasperated the sage. He gave a curse to all the Vasus that they would be born as human beings on earth. But when the other seven went and explained to him that it wasn't an action of everyone but only one Vasu named Prabhas due to the wishes of his wife. The sage redesigned the curse saying the seven vasus who were the silent partners to the crime would be born as human and die the next minute whereas Prabhas alone would be born on earth and live until he cried and beseech for death. He added saying Prabhas would not enjoy sexual pleasure in his whole life as he played the music to the tunes of his wife this time. And he was Devavrat. Devavrat was renamed as Bhishma, later by his father Shantanu. Bhishma meant the one who undertakes intense vows and fulfills it.
Ganga gave birth to 7 kids through Shantanu. She killed all the seven babies the moment they were born. She appeared to be cruel to Shantanu. When the eighth one was born, Shantanu didn't allow her to kill. As per their marriage contract if Shantanu doesn't let her do what she likes she would go away from him. So she disappeared from his sight along with her eighth kid. Shantanu suffered missing Ganga. He longed for her comeback, this fulfilled the curse of Lord Brahma from the part one story. She came back to Shantanu after 25 years and handed over the young Devavrat to him. She explained the secret of their birth and also told him the first 7 kids she killed were the 7 Vasus. This connects the curse of Sage Vasisht in part 2.
Due to the same curse of Sage Vasisht, Bhishma had to live for a very long time and had to undergo several muddles and complications under the kingdom of Dridashtra at Hastinapura. Like the Sage Vashisht cursed, he literally had to long for death lying on the bed of arrows in Kurukshetra war.