Bottom note box.
The title image for this idiom.
Example sentences below!
The origins image for this idiom.
The definition picture for this idiom.
Phrases and Idioms - The Meanings and Origins For Several Common Idioms and Phrases
Note: The origins for most idioms are unclear. Often times, the origins you see listed are plausible theories as to how an idiom came to be, but may not necessarily be so. The quotes you see that contain the phrase are the oldest that I could find, but it's very possible there are older recordings that I missed.

Also, keep in mind, just because you see a saying in a newspaper from 1850 does not mean it originated from that newspaper. In all likelihood, if a saying is already being used in a form of media like that, then it's probably already known at the time and is thus, older. The purpose of these old quotes is to give you somewhat of an idea on how far back in history these sayings go.
The ocean is a big place, so what are the odds of two ships sailing directly past
each other? I have no idea, but it's probably not very high. If it does occur,
though, and it happens to be at night, the ships may shine a light on the other
in order to acknowledge the other's prescence. The shining of the light can be
seen as a greeting, as if the ships are talking to one another, that is, until they pass and disappear into the darkness of the night, never to see the other again. Well, who knows, they might cross paths again at some point.

Anyways, this sort of ship passing situation, at some point, began to be applied to people who meet for the first time, only to part ways shortly after, disappearing into the vastness of the earth. Such people are like two ships passing at night.

The idiom at least over 150 years old. It is written in Tales of a Wayside Inn, by Henry Wadsworth Longfellow in 1863, where it reads:

"Ships that pass in the night, and speak each other in passing, Only a signal shown and a distant
voice in the darkness; So on the ocean of life, we pass and speak one another, Only a look and a
voice, then darkness again and a silence."
* I met a girl today who was visting from Canada, but she's going back home soon and like two ships passing in the night, I don't think I'll see her again anytime soon.

* A few minutes ago, Jason had spoken to a nice man at the coffee shop, but he forgot to ask for the man's name, so he returned. However, similar to ships that pass at night, Jason was unable to find where this man had gone.
Know Your Phrase - The Meanings For Common Phrases and Sayings > S-Letter Expressions
Commonly said about two people who meet for a short time, share a few words,
only to seperate and continue on their way, never to see each other again.
It's picture for a ship!