There is no singular answer to this. It will depend on service and warfare specialty, MOS, ship, etc. So many factors go into this. There are dozens of old threads on these sites asking about lots of different career fields. Take the time to cruise around to older threads and read these.
In general you will go to school immediately upon graduation regardless of Navy or Marine Corps. I think SWOs are the only group that immediately report to ships these days. Schools can range from months to years depending on service selection such as Marine Corps (6-9 months - up to several years), Aviation (2-4 years depending on platform and speed of school), Subs (1-2 years for nuke school and other schools), SEALs (2 years I think these days), EOD (I think 1 year or so, but not sure). This isn't all the opportunities out there, but as you can see you will be in school for awhile for the most part. You would then report to your ship, squadron, battalion, etc after that. Deployments will very for every single unit. I had friends report to ships for the first time underway. Others waited over a year to deploy. Deployments are traditionally 6 months for the most part, but work ups, exercises, etc also need to be factored in. Once you complete you first fleet tour you will then go a shore tour/B billet. These can be a variety of things such as schooling, instructing, acquisition, Pentagon land, monitors/detailers duties, etc. For the most part you are home much more often during shore tours. Some of them you will be home every night, others you may travel extensively.