Upvote:14
This will depend wildly on what country you're in and what the specific circumstances are. Some countries like Singapore don't physically stamp passports anymore, everything is electronic. Others like the Schengen countries in Europe don't have any internal border controls, so not only are there no stamps, there aren't (usually) even any ID checks.
But in general, if you try to leave a country and present different travel documents than what you used to enter, this will almost certainly be flagged by the system and you'll be asked to explain.
If your old passport expired, but you have it with you, they can connect the dots easily and it'll be fine. (Although many countries insist on 6-month validity specifically to avoid this scenario, and you may be have been required to transfer any visas to the new passport as soon as you got it.)
If you lost your old passport and have a new one, you'll likely be asked to show a police report, but will probably be OK. (Again, you may have been required to transfer the visa as soon as you got the new passport.)
And if there's no record of you entering at all because you swum across a river, well, you're going to have some explaining to do, and are likely to get deported as an illegal immigrant.