Yes. Navy blue shirts and black pants can go well together. Black can look good with different colors, from light to dark colors.
Although in some cases navy blue and black cannot look good together, navy blue shirts and black pants can be a great pairing.
This is a good color combination for clothes and a basic outfit idea. Men can wear black shoes (black Oxford shoes, loafers) or navy shoes with this outfit. Women can wear black heeled sandals, or navy blue pumps with this color combination.
Wear your navy shirt and the pants with a black belt. If you want to wear a blazer or a coat, please choose a black blazer or a black coat.
And you can choose black dress pants to go with your navy shirt to complete the office look or It is okay to wear black jeans (black slim fit pants).
Sometimes, you can wear dark brown shoes with this outfit.
Here is an example: