Fingerprints help us in gripping and handling objects in a variety of conditions.
They work on the same principle as the tires of a car.
While smooth surfaces are fine for gripping in a dry environment, they are useless in a wet one.
So we have evolved a system of troughs and ridges, to help channel the water away from the fingertips, leaving a dry surface which allows a better grip.
The unique pattern is merely a useful phenomenon that is used by the police to identify individuals.
Fingerprints are the visible parts of rete ridges, where the epidermis of the skin dips down into the dermis, forming an interlocking structure, similar to interlaced fingers.
These protect against shearing, or sideways stress, which would otherwise separate the two layers of skin and allow fluid to accumulate in the space, and form a blister.
They appear on skin surfaces which are subject to constant shearing stress, such as fingers, palms, toes and heels.
The unique patterns are simply due to the semi-random way in which the ridges and the structures in the dermis grow.