In the pool, the walls at 25 or 50 meters apart mark off the distance and make for convenient points to change your tempo, stroke length, effort, or focus of attention.
In open water, there is not often a way to mark the distance frequently or regularly. If you want to change some metric or point of attention regularly you need a reference point you take with you: counting strokes!
Roughly speaking, an average swimmer’s stroke is about 1 meter (1 yard long). So, the number of strokes (counting each arm) can be used as an estimate of distance too.
For training and racing purposes, you may aim to hold attention on a certain part of your stroke for 2 to 5 minutes, which is a good amount of time for neural training purposes. Estimate how far you can swim in 2 to 5 minutes and that tells you where you may set your stroke count intervals.
But your strength of attention needs to match that duration also. If you can only hold your attention on the chosen focal point for 50, then you may need to set your stroke count interval at 50. For some skills you can sustain attention longer and for others less.
Counting strokes takes up some of your attention, so you may not be able to hold at much detail in your mind as you do while in the pool.
If you would like some encouragement about counting strokes you may read these articles in the library: