The short answer is yes.
The reason for this, and a good example, the create account form you see on many popular websites, many UX evangelists have argued over the years to simply get people registered and into your application THEN pry the additional information from them once registered.
This way you avoid annoying people by asking endless questions, you reduce drop-offs and, potentially, increase your registration throughput.
Similarly in other forms, if the mandatory information is buried deep within the form and some of the fields are optional, but appear first, I would make it easier on my user and bring forward the mandatory information so they can complete the task and not have to wade through forms which may have no relevance to them.
If you can't do this, a different option may be to allow them to 'skip to the next mandatory field,' swap out mandatory for required or similar, but you get the gist.