If you are short an in-the-money option, you could be assigned at any time*. Assignment occurs when the person on the other side of the trade - the option buyer - decides to exercise. If you are short a call option and you get assigned, then you'll have to sell the underlying stock for the strike price. Remember, when the call buyer exercises, he is buying the stock for the strike price. Therefore, you, as the short seller of the call, are obligated to sell him the stock whether you have it or not. If you don't have it, then you'll end up with short stock in your account.
If you are short a put and you get assigned, then you'll have to buy the underlying stock for the strike price. Recall that when a put buyer exercises her put, she is selling the stock for the strike price. Thus, you, as the short seller of the put, are obligated to buy the stock she is selling.
The implications of getting assigned vary and depend on the position you had prior to getting assigned. In many cases, getting assigned can be advantageous. In other cases, not. One thing is certain - the person expercising the option will forfeit all of the option's remaining time value to you.
For example, say that you shorted the option depicted to the left for $3.50. You would have received a $350 credit to your account. Because this option has $1.00 of time value (green portion), you know that you would make $100 in decay profits if you held the option until it expired. But when someone exercises the option and you get assigned, the option ceases to exist and therefore has zero value. You get to keep the total credit of $350; you no longer have to wait for the option's time value to decay to get that $100 in decay profits. Because you were assigned on a short call, you end up short 100 shares of XYZ stock at $35 per share (we're assuming you had no other position prior to assignemnt.) Assuming you don't want the short stock, you must cover it (i.e., buy to close) at the current stock price of $37.50. So you're buying at $37.50 the same stock you just sold short for $35, realizing a loss of $2.50. BUT, you received the $3.50 credit when you shorted the option! You lost $2.50 covering the short stock, but you made $3.50 selling the short option. The difference is a $1.00 profit and is due to the time value.
*This applies only to American Style options, which most equity options are. European Style options can only be exercised at expiration.