Filling in these gaps in door frame
It appears that the trim wasn't properly toed into the door frame. However, it's also possible that there is drywall or a 2x that's proud of the doorframe.
You can fix the gap with painters caulk. However, I would pull the trim off and determine what is causing the gap. If it's drywall it should be easy enough to cut out to fit the trim properly. If it's framing causing it you can plane it down. From there the trim shouldn't be an issue.
Second Edit
Some really good points being made by contributors on possible structural issues. Some questions:  


Is the trim separation a recent development since you moved in?  
Are there any other signs of potential structural shifting in the house?  
Cracks in the walls, ceiling, basement, foundation?  
Doorways that are obviously out of plumb - including this one?  
Did you have a professional do a home inspection when you bought?  


These are all indicators of possible structural shifts that should be assessed by a professional through an on-site inspection and are probably beyond the scope of what we can tell you here.