Conservative force is a force which has a property that the total work done while moving an object between the two points is independent of the path taken. A conservative force is dependent only on the position of the object.
Since work done is independent of the path followed in gravitational field, hence gravitational force is a conservative force.