The construction of pit wells is prohibited. If you have a pit well it is an older well that was installed before the use of pitless adaptors was widely accepted. Pits were dug below the frost line of the soil to prevent pipes and well pump machinery from freezing during winter months. The most common and dangerous problem associated with pits is flooding. If the well pit becomes flooded and the well casing is not properly sealed surface water can enter the well and possibly contaminate the local groundwater system. Electrocution is also a possible hazard for flooded well pits, as often times the well pump, tank, and other machinery is located in the well pit. If your well needs to be serviced by a well driller and you have a well pit, they must terminate the pit by installing casing that extends to at least 4 inches above ground surface, install a pitless adaptor and fill in the well pit.
In the above video, you can see a pit well where the casing does not extend above the floor of the pit. If not sealed probably, water from a flooded pit could enter the well and groundwater system.
This is a video of a flooded well pit. Notice the presence of electrical wiring in the pit. This is an electrocution hazard.