Yes, you can go ahead and buy the tickets now. As long as you have a railcard by the time you have to show anyone the tickets, you'll be fine.
You can either buy the card online, and have it delivered to a place you are staying (kinda dicey, as the time for delivery can vary a little). This way you get a neat, credit-card style (and size) pass.
Alternatively, you can buy from any station ticket office (there's one at Heathrow, although apparently this does not sell railcards (most other airport ticket offices will however ). Don't forget to bring a passport photo of each of you, and you can speed things up by having already filled out the application form. If you do this, you get a larger, paper railcard in a little passbook.
See this from the Railcard FAQs:
Q:Can visitors to Britain buy a Railcard online?
A: You can only buy online is you are able to give a UK-delivery address. We cannot send Railcards to non-UK addresses. Alternatively, you can buy a Railcard at a staffed rail station ticket office in England, Scotland, or Wales or a National Rail-licensed Travel Agent on arrival. You can also buy a Railcard at Gatwick Airport, Stansted Airport rail stations, Luton Airport Parkway and Manchester Airport – but NOT at London Heathrow Airport.
If you're travelling on trains a large amount though, it may make sense to take a look at Britrail passes.
You can read the rules and general information on railcards from National Rail, and the FAQ on the railcard site is also very useful