They are both correct and mean the same - however I prefer #2 as it infers a more general sense of the future.
Attains prosperity - I have made 2 suggestions below because prosperity is not something you "attain" quickly and "prosperity" is an undefined milestone. However, if you need to keep your sentences as they are, how about changing "when" to "until".
The day is not far off until the country achieves prosperity.
The day is not far off until the country becomes prosperous.