According the [FIDE LAWS of CHESS][1]:

> 3.9  
... No piece can be moved that will either expose the king of the same colour to check or **leave that king in check.**

So as @djnavas points out, if you are in check you have to do one of three things:  
- move the king out of check, 
- capture the piece checking you, or
- block the check (by putting one of your pieces in between the king and the piece checking you).

  [1]: https://www.fide.com/FIDE/handbook/LawsOfChess.pdf