There are a couple of things that are concerning Juliet by the time she realizes that he is present in the garden in Act II, Scene II.
Juliet's first concern is that, should her family see him their, they'll kill him. She sees that Romeo has accomplished a fantastical feat by daring to enter the garden. The garden walls have especially been built to keep out enemies, yet Romeo has managed to climb the high garden walls that are difficult to climb. But more importantly, Romeo has accomplished this feat for no known reward other than certain death should he be discovered, as we see in her lines:
The orchard walls are high and hard to climb,
And the place death, considering who thou art,
If any of my kinsmen find thee here. (II.ii.67-68)
Juliet's second concern is that she is embarrassed at being overheard by Romeo in professing her love for him. She's a maiden, and in those times virtuous maidens were expected to be less forward and much less easily won. We see Juliet express her maidenly embarrassment in the lines:
Thou knowest the mask of night is on my face;
Else would a maiden blush bepaint my cheek
For that which thou has heard me speak to-night. (89-91)
She further alludes to her role as a respectable maiden by saying that if he thinks she has been too easily courted, she'll pretend that she does not care for him. Easiness or flirtatiousness in a woman can be a sign of sexual looseness; therefore, Juliet is very concerned about keeping her reputation in tact, as we see when she says, "[I]f thou thinkest I am too quickly won, / I'll frown, and be perverse, and say thee nay" (99-100). To be "perverse" means to be "stubborn" or "difficult"; therefore, in these lines, Juliet is saying that she'll refuse him just so he can pursue her, just as a man ought to pursue a virtuous maiden.
She was delivering soliloquy and she didn't know that someone was there and was scared because she didn't know who it was. She then found out it was Romeo.