Regarding the recent travel ban, federal judges in Hawaii and Maryland both ruled against the ban. What would have happened if one of those judges ruled against the ban and the other did not?
The example that you have given in your question regarding the travel ban does not actually constitute contradiction since one federal judge chose to issue an order but the other does not, thus the actions taken does not contradict.
However, what you described actually happened before with the first travel ban (EO 13769).
A federal judge in Boston, Judge Nathaniel Gorton, refused to extend a temporary injunction against the travel ban. However, another federal judge in Seattle then granted a temporary restraining order Friday that’s effective nationwide.
As this CBS article states:
Meanwhile, in a seemingly contradictory ruling, a federal judge in Boston refused to extend a temporary injunction against Mr. Trump’s travel ban.
U.S. District Judge Nathaniel Gorton late Friday declined to renew an order prohibiting the detention or removal of persons as part of Trump’s executive order on refugees and immigrants.
In this case, Judge Gorton declined to extend a temporary injunction against the travel ban. So, legally, nothing changes since he did not issue any new order or temporary injunction; the EO (travel ban) will stay as it is and when the existing temporary injunction expires, the EO will be back in force.
Even yesterday, the federal judge in Hawaii issued a temporary restraining order which blocked the travel ban from being enforced. However, the federal judge in Maryland only blocked part of the travel ban, ruling that the most important section — banning travel from half a dozen countries — could not be enforced.
The Hawaii court ruling would still "take precedence" since the temporary restraining order blocked the whole EO.
Thus, it can be seen that there are mainly three ways for federal judges to rule:
- Grant a temporary restraining order for the travel ban.
- Block part of the order.
- Decline to issue any order; the travel ban will remain as is.
To conclude, whenever a federal judge issues a temporary restraining order, it will always be in force as it would "overwrite" the other federal rulings in which the judges blocks part of the order or do not issue any order.
To answer the more general question in the title:
What happens if federal courts contradict each other?
It depends on the context.
In some cases, like this, the outcome is the same. If one district court decides to issue an injunction (or restraining order) then the injunction exists even if other courts decline to issue a similar injunction. Only a superior court (the relevant appeals court or the Supreme Court) can invalidate the injunction; another district court cannot.
In other cases, it results in different, possibly conflicting, legal precedent in the courts' respective jurisdictions. In that case, it also increases the likelihood that the Supreme Court will review the cases so it can resolve the conflict and set a uniform precedent for the country. Until that happens, though, federal law can actually be different in different parts of the country.