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.
The meeting lasted for two hours.
The drought lasted several months.
are both valid ways to construct the sentences in addition to the versions you posted. The meaning doesn't change.