My understanding is that the goal is to advance society (not really the sciences) by enabling someone to produce their invention so society can benefit from it. The patent protects someone from having that invention copied as soon as it is put to use, which provides motivation to spend the time inventing it.