Hobbit
I assume from the question that you are female, and this is of course about sexual discrimination in the selection phase of the recruitment process.
As previous answers have indicated, it is not so much the asking of the question that is the problem, but what they do with your answer. It is very, very bad practice to ask this sort of broad question that doesn't really go anywhere, and anyone remotely educated in hiring and firing knows that this is not the way to go about getting the info they might be after.
So firstly - is who you share your bed with, or your childbearing capacity relevant to the job in question?!
Secondly, did they offer it to you?
If you get an offer then don't worry about it but think carefully about whether you want to work there.
If you dont get an offer then call them up and ask:
- why was I unsuccessful
- what sort of person did you hire
- can you explain the relevance of my marital status and number of dependants.
- ask them to put all of that in writing (this last point just for a laugh of course)
You will have to decide what you do with their answers.