Two women hiking in Maine were rescued after getting lost, but died in a car accident when they drove into the ocean Tuesday.

According to the Associated Press, the women were Amy Stiner, 37, of Machias, Maine and her friend, Melissa Moyer, 38. Moyer was visiting from Pennsylvania and five months pregnant.

Washington County Sheriff Donnie Smith confirmed that Stiner had driven straight down a boat ramp at a dead end and the car went into the ocean. Smith said that they had called, saying “that they were in the water and the car was filling up. Then the phone went dead.” He explained that deputies arrived an hour later and found the two dead.

It was foggy and Smith said that weather may have been a factor.

The Bangor Daily News reports that only hours before, the women were lost in the Roque Bluffs State Park because of the fog. The Maine Warden Service contacted local firefighter and area resident Wayne Hanscom, who used his ATV to find the women and their dog. He took them back to their house, where a warden picked them up and drove them to their car. They drove off, heading toward Machias. But they went the wrong way, heading towards the boat ramp.

When authorities arrived at the car, it was discovered 15 feet off the ramp and the dog was inside the car. They had their windows rolled up.

“It appears they went the wrong direction and drove off the ramp,” Smith explained. "If you don't know the area, in the fog and rain it wouldn't be a difficult thing to do."

The accident is still under investigation.