I saw this sentence in a website:
Each time you sleep with someone, you also sleep with his past.
What is the 'past' mentioned here?
We'd have to see the context to know for sure, but I strongly suspect it's referring to the idea that you're sleeping with all of your partner's past sexual partners. Particularly, you risk being exposed to any sexually-transmitted diseases that your partner may have been exposed to.
It's referring to the risk of contracting an Sexually Transmitted Disease.
Each time you have sex with a new partner, your risk of contracting an STD rises, especially if your partner has also had many partners. You don't know if they've been using condoms, etc. or if they've been irresponsible.
Since many STD's are symptomless for quite some time, you could be infected and 'passing it along' without knowing it.
The past is the past - what the person did, experienced, accomplished in their life up to the present moment.
Here is a definition of past from Merriam-Webster
a : time gone by
b : something that happened or was done in the past
a : the past tense of a language
b : a verb form in the past tense
a past life, history, or course of action; especially : one that is kept secret
In your sentence it's the 3rd meaning.