Runcible, your request may use some rewriting. You should always specify your JOIN clauses in the ON clause, and not in the WHERE clause.
Your request will look like this:
SELECT TableB.bar
FROM TableB
JOIN TableA
ON TableB.shared_id = TableA.shared_id
AND TableA.foo = 1000;
You not only want to do this:
ALTER TABLE TableB ADD INDEX (shared_id,bar);
You need to add the index as follows:
ALTER TABLE TableA ADD INDEX (foo, shared_id);
Do this and specify the output of EXPLAIN.
Also note that by adding an index to (shared_id, bar), you just made your (shared_id) index redundant. Throw it.