Marble: Yes you need to have your marble sealed with a good quality penetrating sealer as it is a more porous stone. Unsealed marble will stain more easily. Basically, sealing buys you insurance time to clean spills up before it stains the stone. Penetrating sealers do not alter the appearance or gloss level of the stone.
A penetrating sealer will get into the micro pores of the stone to reduce the ability of contaminants to adhere to the stone. They are not a coating which sits on top of the stone surface.
Although, penetrating sealers will not protect marble from etching (dull spots) as this process is a reaction between the acidic product and the very top surface of the stone.
Coating-type sealers are also available (e.g. Dry Treat’s Vitremela) which will protect the marble from etching as well as staining but does add significant cost to stone top installations.
Granite / Quartzite: Not all require sealing. Generally darker coloured granites do not require sealing at all. As a general rule, we recommend that medium to light-coloured granites be sealed, as they are generally less stain resistant than darker-coloured granites.
Sealing is often a service that is offered by stone fabricators on/before installation but there are also specialized companies such as “The Marble Man” that offer this service after tops have been installed.