While in-flight on an airplane, most airlines (and all airlines in the United States) will not allow you to use your mobile phone. Some throughout Europe do allow their use; it is best to check with your airline. The reason many airlines do not allow the use of mobile phones in-flight is because they do not want the mobile phone signals to interfere with the plane's instruments and equipment. To stay connected, many airlines will let you use your mobile phone before the plane takes off and after it lands. Some also have onboard phones that you can use for a fee.
Many smartphones are capable of being put in “airplane mode,” which deactivates the cellular network and mobile phone signal. Airplane mode allows you to still access the applications on your smartphone, as long as they do not rely on receiving data from a cellular network. To set an iPhone to airplane mode: go to settings, and the first option you will see is to set airplane mode to “on.” On an Android device: go to settings, then wireless and networks, and the first option you should see is a checkbox to set your phone to airplane mode.
Regarding ships: on a newer ship, it is likely that you can use your mobile phone while out at sea. On older ships, you may have to wait to be in port to make phone calls. You should contact your cruise line to find out what kind of mobile phone service they have. You should also contact your mobile provider before you leave to find out what kind of rates you may be charged aboard your ship - it can be more than usual.