The Bible doesn’t explicitly say whether or not Mary was asked for her consent, but she’s presented as considering it a great honour and joy to carry Jesus. Of course, all the Gospels were written by men and many decades after the event, so they probably didn’t get a first-hand account from the woman herself.