Flashing in construction is used to prevent water penetration into a building by directing the flow of water away from potential entry points such as joints, corners, and intersections. It is commonly made of metal or waterproof material and is installed around openings like windows, doors, and roof intersections to protect the building from water damage and leaks.