This would necessitate having to know the ships schedule and routine and possible movements of sailors from point A to B, and we haven’t even touched on watch guards or patrols yet.
Eventually, even if you brought your own, you would need food and water, unless you had some kind of plan in place to get out before those run out.
Getting out you risk being caught as well.
As a sidenote, it would not be impossible. I was fairly bored in the navy and I’ve snuck both onto my ship and onto military bases avoiding the main gate. Only difference was, I was in the military at the time and although getting killed doing so was a possibility, especially at 2am, getting caught would have been more likely and resulted in some form of disciplinary action.