A field is set as either mandatory or non-mandatory at the table (object) level and can not be changed with validation rules.
It is a parameter of the field settings.
Are you using “display rules” to show and hide fields based on other selections?
If you have a field that you require such as a “passport” file upload, it would likely be a field that you want to set as mandatory.
However, that would mean that a file has to be uploaded even if the user doesn’t have a passport available.
You could add another multi choice field called “Passport - Yes/No” to the table before the file field with just yes and no as options.
This would be a mandatory field set to “Yes”.
On the submit form you could then have a display rule that hides the passport file field if the Yes/No field is changed to No.
This way the passport file field is mandatory but can be skipped over with the Yes/No field before being toggled to “No” and hiding the file field.
Once the passport file field is hidden it’s mandatory status is ignored as the field is not visible.
I’m not sure if this helps you but a field only has two states, mandatory or non at the field object level and can’t be changed elsewhere or by other means.