"You need to undergo the medical tests within 6 months from the departure date"
The closest choice would be:
- You need to undergo the medical tests within 6 months period prior to the departure date.
However, to be clear and easy to understand, you would better rewrite it as:
You need to undergo the medical tests within the period of six months prior to the departure date.
(Numbers less than thirteen are usually spelt out).
I have two suggestions, of which I like the first better.
You need to get the medical tests during the six months before your departure date.
You need to get the medical tests no earlier than six months before your departure date.
The preposition within is usually used for time periods after the reference time, so within six months of the departure date would normally be understood to mean the six months after the departure date. Using it for the earlier time period is confusing.
You could always just spell it out and be super-clear:
You need to undergo the medical tests prior to the departure date, but no more than six months before.
I would suggest a rewrite like this:
A medical test must be taken inside the six month time window before your departure date.