(thanks to Yoram Gat, statistician)
Margin of error is not exactly the right term. ‘Margin of error’ is used when using a proportion in a sample to estimate the proportion in the population. In our case the proportion in the population is known (50.8% women; 49.2% men), and we wish to bound the proportion in a sample. I would use something like “random fluctuation”.
To simplify, let us say the proportion is exactly 50-50. So in the case of a sample of 500, you will have at least 239–261 about 70% of the time, at least 227–273 about 95% of the time, and at least 216–284 about 99.5% of the time.
The chance of having a split that is worse than 200/300 is about 1:100,000.
The chance that either there would be more than 350 men or more than 350 women in the group of 500 is less than 0.2 millionth of a millionth of a millionth (2 x 10^-19)
In making these calculations, the size of the population doesn’t matter unless it is tiny – the statements are as true for a city of 100,000 as they are for a country of hundreds of millions. It is only the size of the sample that matters. As a rule of thumb, on each particular issue the sampling error is about 1 / (2 sqrt(n)), where n is the size of the sample.
This means, further, that if any group makes less than 40% of the population, then the chance that it will form a majority in a group of 500 randomly selected people is less than 3 in a million.