Upvote:3
Ferries generally follow a timetable (departing and arriving et predetermined times) and a specific route.
Google Maps has a database of the known ferry routes that contains the lengths of various routes, the time can easily be calculated from the timetable. Both numbers are then included in the driving directions.