Hello Jason, and welcome to cruise-chat!
Absolutely, you can stay aboard the ship while in port. In fact, I often do this when my cruise goes to a port which I've visited before. Actually, staying aboard while the ship is in port is a good thing. The ship will be empty but they still have a couple bars open, the dining room and buffet will be open, and you essentially have the ship to yourself. Many of us savvy cruisers look forward to staying on the ship during a port day! It is a great time to be at the pools.