On old steel bikes a good reason would be to prevent the seatpost from rusting onto the frame, thus preventing saddle height adjustment.
More recently I understand from my LBS that you do it to prevent water from seeping into the frame along the (imperfectly sealed) seatpost.
Depending on your frame you could end up carrying one or more kilo's of water with you if you have a lot of rainy rides.
bicycles.stackexchange.com/users/424/jilles de wit
I present you with evidence that seatposts can, in fact, seize ! Alloy and steel seatposts are both perfectly capable of seizing to both alloy and steel frames.
IIRC, carbon seatpost/frame combinations may need carbon assembly paste for almost the opposite reason: to increase friction and reduce the torque required for a good grip.
bicycles.stackexchange.com/users/3311/Useless
In addition to the seizure problem that others have mentioned, greasing the seatpost also prevents another problem: creaks.
I once spent weeks chasing down a creak that I initially thought was coming from the crank or bottom bracket.
After disassembling and reassembling all that stuff, then tightening almost every single bolt on the bike, someone suggested that the creak could be coming from the seatpost rubbing inside of the seat tube
and I should grease it.
Bingo!
Problem solved.
bicycles.stackexchange.com/users/4239/jimchristie
Depends: Frame and post material matters.
With metal, bonding or rust can occur Carbon posts can need the friction because they tend to be a smoother material
There can be imperfections that are too small for us to notice, so the grease can help to fill the gap for the seatpost retention to work
bicycles.stackexchange.com/users/2735/OMG Ponies
That bit of grease on the seat post into the seat tube will help "seal" the seat tube from getting any moisture into the bike frame.
It may also keep the seat post from seizing in the seat tube.
It does happen if the seat isn't moved for years.
bicycles.stackexchange.com/users/None/
When I bought a new bike my LBS put grease on the part of the seatpost that inserts into the frame.   Why is this? Surely it can't seize?
Why did the bike shop put grease on my seatpost?
bicycles.stackexchange.com
<seatpost>
bicycles.stackexchange.com/questions/11212
bicycles.stackexchange.com/users/3140/Mark W
For steel bikes the seat post is greased for two reasons mainly. First to stop the seat post from rusting onto the frame. Second to act as a sealant and prevent any moisture getting into the frame.  Carbon seat posts, on the other hand, need the grease to create friction as they are so smooth. Furthermore, the grease also stops the seat from creaking. Steel seatposts can rust onto the frame, so grease can prevent rust and stop moisture from entering the frame, while filling in slight imperfections that can impede seatpost retention. Grease also prevents seatposts from creaking. Carbon bikes may need assembly paste to increase friction and grip.
Steel seatposts can rust onto the frame, so grease can prevent rust and stop moisture from entering the frame, while filling in slight imperfections that can impede seatpost retention. Grease also prevents seatposts from creaking. Carbon bikes may need assembly paste to increase friction and grip.