In this paper, we applied Markov random field processing to geophysical data as an alternative to classical deterministic approaches. Markov random field processing is an unsupervised statistical model-based algorithm, which does not require a priori information. We present a dynamic programming based on evaluation of noisy and superpositioned effects of the various geological structures considering a statistical maximum a posteriori criterion. The objective of the proposed modelling is to capture the intrinsic character of the input potential anomaly map in a few parameters, so as to understand the nature of the phenomenon generating the anomaly. In order to decrease processing time and to enhance image performance of the Markov random field, we introduce a preprocessing step. The preprocessing step is crucial and it helps us to solve difficult multi-disciplinary problems such as separation, enhancement of magnetic anomalies and border detection. We also decrease the noisy peak values of pixels by this smoothing process and emphasize the discontinuity properties of the noisy data by an absolute differentiation procedure. Here, the magnetic field of the input data is considered as a two-dimensional image with a matrix composed of N-1 x N-2 pixels. We evaluate each pixel of the N-1 x N-2, matrix using the Markov random field approach, regarding the neighbouring pixels and their locality in real time with no a priori training procedure. As synthetic examples, various prism models are considered and the separation and edge detection performance of the Markov random field is tested. As real data, we have evaluated the magnetic anomaly map of the Hittite civilization in the Sivas-Altinyayla region of Turkey. We have obtained satisfactory results in both synthetic and real data and concluded that the Markov random field is a compromising approach for the separation problem of regional-residual anomalies and edge detection of various geological bodies.