1) The meeting lasted two hours.
2) The drought lasted for several months.
These sentences are from Cambridge Dictionary. My question is - Why is there a preposition used in second sentence but not in first?
In this case the preposition is optional.
are both valid ways to construct the sentences in addition to the versions you posted. The meaning doesn't change.