We can calculate it approximately.
Let's look first at the number of ways of putting 7 pieces including a white and black king and no other kings on a chessboard without worrying about whether the position is legal.
First place the two kings: 64*63 ways to do that.
Now choose 5 other squares for the remaining 5 pieces: 6261605958/120 ways. (We divide by 120 because there are 120 orderings of 5 squares and the ordering doesn't matter. The number can be called "62 choose 5".)
Now choose which of the 10 remaining possible pieces (black pawn, white bishop, etc) can be placed on those 5 other squares. This is 10^5 or 100000.
So the total number of ways of placing the white king, the black king and 5 other pieces on a chessboard is:
64636261605958*100000/120
=2609108006400000
or about 2.609 * 10^15
Multiply by 2 because either side may be to move:
5.218*10^15
Now we must estimate the number of those positions which are illegal. For example, the kings must not be together, any pawns must not be on the first or last rank, and some other considerations. This is licking my finger and sticking it in the air, but let's guess that about 90% will be legal positions. 90% of 5.218*10^15 is about
4.7*10^15
You might want to divide that number by 2 if you want to regard a position which is the same but with White and Black reversed as the same position.
We can calculate it approximately.
Let's look first at the number of ways of putting 7 pieces including a white and black king and no other kings on a chessboard without worrying about whether the position is legal.
First place the two kings: 64*63 ways to do that.
Now choose 5 other squares for the remaining 5 pieces: 62*61*60*59*58/120 ways. (We divide by 120 because there are 120 orderings of 5 squares and the ordering doesn't matter. The number can be called "62 choose 5".)
Now choose which of the 10 remaining possible pieces (black pawn, white bishop, etc) can be placed on those 5 other squares. This is 10^5 or 100000.
So the total number of ways of placing the white king, the black king and 5 other pieces on a chessboard is:
64*63*62*61*60*59*58*100000/120
=2609108006400000
or about 2.609 * 10^15
Multiply by 2 because either side may be to move:
5.218*10^15
Now we must estimate the number of those positions which are illegal. For example, the kings must not be together, any pawns must not be on the first or last rank, and some other considerations. This is licking my finger and sticking it in the air, but let's guess that about 90% will be legal positions. 90% of 5.218*10^15 is about
---------------
4.7*10^15
---------------
You might want to divide that number by 2 if you want to regard a position which is the same but with White and Black reversed as the same position.