Drawing a weapon as part of an attack is something that happens on your turn, specifically during your move or our action (not your reaction).
Player's Basic Rules v0.3, page 70. Player's Handbook, page 190.
Other Activity on Your Turn
You can also interact with one object or feature of the environment for free, during either your move or your action. For example, you could open a door during your move as you stride toward a foe, or you could draw your weapon as part of the same action you use to attack.
Opportunity attacks happen on someone else's turn (usually), so you can't draw a weapon. If you don't have a weapon in hand then you can't use it to make an attack of opportunity.
Even if the attack of opportunity happens on your turn (e.g. dissonant whispers, hat-tip Meta4ic), it would use your reaction, and the free object interaction does not apply to your reaction.
Player's Basic Rules v0.3, page 73. Player's Handbook, page 195.
To make the opportunity attack, you use your reaction to make one melee attack against the provoking creature.
As an aside, this is why the War Caster feat is useful - you can cast a spell without having to drop or stow your weapon, so the weapon is still in hand for opportunity attacks.
Player's Handbook, page 170.
• You can perform the somatic components of spells even when you have weapons or a shield in one or both hands.