Yes this is legal. An employer can require such a disclosure be made if it furthers a legitimate business interest (a married couple working for the company violates corporate policy, is needed for health insurance purposes, etc.). This is true so long as such action does not also constitute some form of legally actionable discrimination or breach the terms of a union agreement or employment contract. The fact is that, a company can set the conditions of employment much as it it sees fit.