No. Conditions in a will (“charges”) must be possible (Civil Code, Article 900).
Here she has two capacities: legatee (bound by the condition) and legal heir as spouse. If she refuses the legacy, she is no longer bound but can still inherit as surviving spouse.